Random numbers same each time. Seed?
Posted: Sun Aug 12, 2018 12:17 pm
Hi,
I'm trying to generate a random number on a button press. 1 - 10.
In FC7, I'm just using a C snippet containing "Ran1 = random () % 10 + 1"
This works fine in software, but the moment I burn it to the chip (using a "12F1840"). I get the same sequence of random numbers every time.
I'm asuming this is because the seed being used is the same each time, but for the life of me I cant find out how to change the seed.
Any help would be much appreciated.
Thanks.
I'm trying to generate a random number on a button press. 1 - 10.
In FC7, I'm just using a C snippet containing "Ran1 = random () % 10 + 1"
This works fine in software, but the moment I burn it to the chip (using a "12F1840"). I get the same sequence of random numbers every time.
I'm asuming this is because the seed being used is the same each time, but for the life of me I cant find out how to change the seed.
Any help would be much appreciated.
Thanks.