Generates a random integer between a and (b-1). So if a=1 and b=7 this node will generate integers between 1 and 6.
random-a-b
@/random-a-b
Generates a random integer between a and (b-1). So if a=1 and b=7 this node will generate integers between 1 and 6.
UPDpulse
Update
anumber
Lower limit of range of integers.
bnumber
Upper limit of range of integers.
OUTnumber
A random integer between a and (b-1).
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 a = getValue<input_a>(ctx);
long b = getValue<input_b>(ctx);
emitValue<output_OUT>(ctx, ESP8266TrueRandom.random(a,b));
}
}
}