Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / RND( ) ...not working? Help!

Author
Message
Brent_Seraphim
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: United States
Posted: 3rd Jul 2003 01:08
Alright...I'm trying to generate random numbers to generate random items...every works out great..except my 'Random Number's are the exact same at every run.

Start:

Random_Number = 0
StartGeneration:

Random_Number = RND(64)
Random_Number = RND(64)
Random_Number = RND(64)

Print Random_Number
Wait Key
Cls
Goto Start

On my comp it generates:
29, 59, 52, 0....

So I said ok..and closed down my little rotine...and started it up again... and it gave me:
29, 59, 52, 0.... Basically no matter what I do it 'RANDOMLY' generates the same numbers! Help! What am I doing wrong?
"Laugh to scorn the power of man..."
qwertzuiop
21
Years of Service
User Offline
Joined: 12th May 2003
Location: Cyberspace
Posted: 3rd Jul 2003 01:19
Insert this line to the begining of the program:
RANDOMIZE TIMER()
Brent_Seraphim
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: United States
Posted: 3rd Jul 2003 02:08
Bless you good man!!!

"Laugh to scorn the power of man..."
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 4th Jul 2003 19:28
thats why you use randomize timer() as this reseeds the rnd() command(whatever?)its not actually random apparantly, because computers can do random stuff or something like that i saw a post where it was explained.

hi guys

Login to post a reply

Server time is: 2024-11-24 20:42:16
Your offset time is: 2024-11-24 20:42:16