random-n

wayland/esp8266-true-random/random-n

Generates a random integer between 0 and (n-1). So n=6 will generate integers between 0 and 5.
random-n
@/random-n
Generates a random integer between 0 and (n-1). So n=6 will generate integers between 0 and 5.
UPDpulse
Update
nnumber
Upper limit of range of integers
random-n
OUT
UPD
n
OUTnumber
A random integer between 0 and the highest signed long integer 2,147,483,647.
To use the node in your project you should have the wayland/esp8266-true-random library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

// Tell XOD where it could download the library:
#pragma XOD require "https://github.com/marvinroger/ESP8266TrueRandom"

//Include C++ libraries
#include <ESP8266TrueRandom.h>

node {
    void evaluate(Context ctx) {
        if (isInputDirty<input_UPD>(ctx)) {
            long n = getValue<input_n>(ctx);
            emitValue<output_OUT>(ctx, ESP8266TrueRandom.random(n));
        }
    }
}