Loading...
Searching...
No Matches
Random numbers

random(), randomSeed(). More...

Functions

long random (long)
 Pseudo-random number from 0 up to, but not including, the argument.
long random (long, long)
 Pseudo-random number from the first argument up to, but not including, the second.
void randomSeed (unsigned long)
 Starts the random sequence at a new point.

Detailed Description

Function Documentation

◆ random() [1/2]

long random ( long )

Pseudo-random number from 0 up to, but not including, the argument.

random(max).

Returns
0 to max - 1; 0 if max is 0 or less.

◆ random() [2/2]

long random ( long ,
long  )

Pseudo-random number from the first argument up to, but not including, the second.

random(min, max).

Returns
min to max - 1; min if min is not less than max.

◆ randomSeed()

void randomSeed ( unsigned long )

Starts the random sequence at a new point.

Without it, random() gives the same sequence after every reset. Seed with something that differs each time, e.g. micros() when a button is first pressed. A seed of 0 is ignored.