RandomSeed

From chipKIT
Jump to: navigation, search

Synopsis

void randomSeed(unsigned int seed)

Description

randomSeed() configures the pseudo-random number generator with a new base value to start generating random numbers from. Without using this the generated random numbers will follow a predictable pattern.

Return Value

None

Conforming To

randomSeed() conforms to the Arduino 1.6.x API.

Examples

Seed the random number generator from white noise from a floating analog input:

randomSeed(analogRead(A0));
int rnum = random(0, 10);

See Also

map(), random()