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.

DarkBASIC Discussion / quick question about Randomizing numbers

Author
Message
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 15th Dec 2008 01:05
is there a way to make it so it randomizes differently every time i run the game because it always comes up the same
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 15th Dec 2008 12:32
at the beginning of your program use:

RANDOMIZE Timer()


That should do the trick.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Robert The Robot
18
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 15th Dec 2008 16:59
"Randomize" takes a new number to be the "seed" used to generate future random numbers. Timer() increases at a rate of 1000 times a second from the moment the computer is switched on.

So using Timer() as the seed number pretty much guarantees that the resulting set of random numbers will always be different.

Hope this helps!

"I wish I was a spaceman, the fastest guy alive. I'd fly you round the universe, in Fireball XL5..."
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 15th Dec 2008 20:41
oh ok thanks i was just confsed why it was always the same haha

Login to post a reply

Server time is: 2025-06-08 00:07:28
Your offset time is: 2025-06-08 00:07:28