Random Number Generator

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

Information: Random Number Generator