Random Number Generator

Download the Entropy library by Walter Anderson (GPL3) and copy the "Entropy" folder into the "libraries" folder eg C:\Program Files (x86)\Arduino\libraries Then the code below should compile and make an LED on PB0 flash pseudo-randomly. randomSeed() sets the initial state of the pseudo random number generator. Try changing it to randomSeed(1) and it will do the same blink pattern each time!
#include <Entropy.h> void setup() { Entropy.initialize(); int seed_value = Entropy.random(); randomSeed(seed_value); pinMode(PB0, OUTPUT); //LED on Model B } void loop() { int rand = random(1,3); if (rand == 1) { digitalWrite(0, HIGH); } else { digitalWrite(0, LOW); } delay(100); }