<commit_before>/* jshint undef: true, node: true, eqeqeq: true, esnext: true */

var strip = require('rpi-ws281x-native');
strip.init(32);
strip.setBrightness(100);

var leds = [
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0xff0000    
];

strip.render(leds);
var interval = setInterval(function() {
    console.log('Rendering!');
    var led = leds.shift();
    leds.push(led);
    strip.render(leds);
}, 100);

setTimeout(function () {
    console.log('Stop!');
    clearInterval(interval);
    strip.reset();
}, 10000);<commit_msg>Fix random colour generation.<commit_after>/* jshint undef: true, node: true, eqeqeq: true, esnext: true */

var NUMBER_OF_LEDS = 32;
var strip = require('rpi-ws281x-native');
strip.init(NUMBER_OF_LEDS);
strip.setBrightness(100);

var leds = [
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0    
];

// Loop every 0.1 sec: randomise an index and a colour and display it
strip.render(leds);
var interval = setInterval(function() {
    var randomIndex = Math.floor(Math.random() * NUMBER_OF_LEDS);
    var randomColour = Math.floor(Math.random() * 0xffffff);
    leds[randomIndex] = randomColour;
    console.log('Rendering colour ' + randomColour + ' at index ' + randomIndex);
    strip.render(leds);
}, 100);

// After 10 secondes, stop.
setTimeout(function () {
    console.log('Stop!');
    clearInterval(interval);
    strip.reset();
}, 10000);
{'fraction_non_alphanumeric': 0.1843191196698762, 'fraction_numerical': 0.07221458046767538, 'mean_word_length': 4.069686411149826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2687295', 'n_tokens_mistral': 618, 'n_tokens_neox': 580, 'n_words': 107}