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.

Dark GDK / random #s

Author
Message
Grenadiac111
14
Years of Service
User Offline
Joined: 23rd Dec 2009
Location:
Posted: 15th Jan 2010 23:25
in my game i need my program to generate a random whole number between 1 and 20 and then put that number into an int named GunInt. The problem is that i dont know what command i can use to make a random number. can some one please tell me how to generate a random #.
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 15th Jan 2010 23:59 Edited at: 16th Jan 2010 00:01


or



www.touchofdeathproductions.com
Grenadiac111
14
Years of Service
User Offline
Joined: 23rd Dec 2009
Location:
Posted: 16th Jan 2010 00:22
i take it that the 20 means maximum of 20 right? Just one question though does that start at 0 and go until 20, start at 0 and go until 19, or does it start at 1 and go til 20.
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 16th Jan 2010 02:30 Edited at: 16th Jan 2010 02:31
I believe its 1 to 20. Yes that is the maximum.

The command documentation states


This command will return a random number between 0 and the range provided. The integer range will be the highest number you want returned.

www.touchofdeathproductions.com
Grenadiac111
14
Years of Service
User Offline
Joined: 23rd Dec 2009
Location:
Posted: 16th Jan 2010 02:47
alright thanks but just so i dont have this problem agian where can i find the command documentation.
Marsh0
15
Years of Service
User Offline
Joined: 18th Mar 2009
Location:
Posted: 16th Jan 2010 03:40
C:\Program Files\The Game Creators\Dark GDK\Documentation

If you installed into the default directory i think its in there.

www.touchofdeathproductions.com
WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 16th Jan 2010 05:47
It is actual 0 to 20. The easiest way to prove this would be to use dbRND( 0 ), dbRND( 1 ), or any small range and test to see what values are returned. You can check what values are returned using if statements.

Login to post a reply

Server time is: 2024-11-20 07:39:08
Your offset time is: 2024-11-20 07:39:08