Hello,
I have been working hours with the random number generator which seems to not be random at all. I need someones help here please. Does anyone have any code they are willing to share showing how to make the random number generator actually random without adding additional external hardware. I am using an external 9v AA battery pack for power and want to generate a random number on every power cycle. Running only a uOLED-128-G2 display, Goldelox.
At every power up it seems that the random number is always the same.
"pick" is set as a var pick := 0;
Thanks,
Rob
SEED(1000); // set a number range to randomly choose from
for (cyc:=0; cyc<3; cyc++)
pick := ABS(RAND() % 50); // picks 0 to 50
print(pick); // to debug
pause(300); // to debug
gfx_Cls();
next
print ("Random ", pick); // random picked #
pause(1000);
gfx_Cls();
I have been working hours with the random number generator which seems to not be random at all. I need someones help here please. Does anyone have any code they are willing to share showing how to make the random number generator actually random without adding additional external hardware. I am using an external 9v AA battery pack for power and want to generate a random number on every power cycle. Running only a uOLED-128-G2 display, Goldelox.
At every power up it seems that the random number is always the same.
"pick" is set as a var pick := 0;
Thanks,
Rob
SEED(1000); // set a number range to randomly choose from
for (cyc:=0; cyc<3; cyc++)
pick := ABS(RAND() % 50); // picks 0 to 50
print(pick); // to debug
pause(300); // to debug
gfx_Cls();
next
print ("Random ", pick); // random picked #
pause(1000);
gfx_Cls();
Comment