From Microduino Wiki
Jump to: navigation, search


  • Description

Use randomSeed() to initiate pseudo random number generator, to make the generator start from an arbitrary point in the random sequence, which is very long, random, and it is always the same sequence.

If you need a truly random number to be generated in a random() sequence, you can use randomSeed() to preset an absolute random input when its subsequence is being executed. For example, the returned value of function analogRead() on a disconnected pin.

On the other hand, sometimes the accurate repeat of the pseudo random number is also useful. So before the start of a random sequence, it can be completed through calling a randomSeed() with fixed numbers.

  • Parameter

long,int - Generate seeds through numbers.

  • Return

No returned values.

  • Example

long randNumber;
void setup(){
void loop(){
  randNumber = random(300);

[Return to Arduino Syntax Manual]