The function Random() returns a random number between 0 and 4.294.967.295. Check this yourself with the next example:
uint number = 0;
bool Update() {
if(Kb.bp(KB_SPACE)) number = Random();
5 return true;
}
void Draw() {
D.clear(BLACK);
10 D.text(0, 0, S + number);
}
You will rarely need a number this big. Which is why you can use the Random() function with one or more arguments. When used with one argument, the function will return a number in the range 0 to the argument minus one. In other words, Random(5) will return one of the values 0, 1, 2, 3 or 4. Count them, that’s 5 different values. A common beginners mistake is to expect the number five as a result. That will never, ever happen!
It is also possible to pass two arguments. Random(-2, 4) returns one of these values: -2, -1, 0, 1, 2, 3 or 4. The important thing to remember that with this version, the arguments are inclusive.