chipKIT® Development Platform

Inspired by Arduino™

Last edit: 2021-03-21 22:34 by Majenko

RandomSeed

  1. Synopsis

  2. Description

  3. Return Value

  4. Conforming To

  5. Examples

  6. See Also

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()