blob: e9f009ce2ede444349723581ce675233454507d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
/*
* SetRandomSeed.
*
* You can use TrueRandom to set the seed for the normal Arduino
* random number generator.
*
* That way you can quickly generate random numbers that are
* different every time using the random number generator.
*/
#include <TrueRandom.h>
int i;
void setup() {
Serial.begin(9600);
Serial.println("Here are some pseudo random digits.");
for (i=1;i<=20;i++) Serial.print(random(10));
Serial.println();
randomSeed(TrueRandom.random());
Serial.println("Here are some random seeded pseudo random digits.");
for (i=1;i<=20;i++) Serial.print(random(10));
Serial.println();
}
void loop() {
}
|