I would like to use randomseed to generate different random numbers each time I run my program. I am using an attiny and do not have any unused pins, so I can't use randomseed(analogRead(0)) as recommended on the randomseed reference page. Is there another way to ensure that I get a different random number each time?
I think I understand what you mean, but ideally, I'd like it to increment / decrement the value stored in EEPROM by a different random amount each time. Do you have ideas of how to do this? Thanks for your help!
If you give the randomseed function a different value every time, it should come up with a completely different start point for the random values, so just incrementing it by 1 will work.
thanks for your code, WizenedEE. I found that the "random" number generated by your code always ended up being 7 greater than the last one up to 100. I edited your code to increment the EEPROM value by a random number, and it seems to work ok:
void setup(){
Serial.begin(9600);
unsigned int id = EEPROM.read(0);
randomSeed(id);
// id = random(50,125);
EEPROM.write(0, id+random(10));
id = random(50,125);
Serial.println(id);
}
void loop(){
}