Random Number Generation

Started by VonHage, Thu 14/08/2003 02:02:41

Previous topic - Next topic

VonHage

Is there a plugin or a standard function for generating a Random number? ???

Dr Snark

Random
Random (int max)

Returns a random number between 0 and MAX. This could be useful to do various effects in your game.
NOTE: The range returned is inclusive - ie. if you do Random(3); then it can return 0, 1, 2 or 3.

Example:

int ran=Random(2);
if (ran==0) NewRoom(1);
else if (ran==1) NewRoom(2);
else NewRoom(3);

will change the current room to room 1,2 or 3 depending on a random result.


Taken Directly From the MANUAL

RTFM!

TerranRich

QuoteRTFM!

Indeed. NEW RULE! All posts will be locked if the answer is easily found in the AGS manual. Thank you, buh-bye.
Status: Trying to come up with some ideas...

SMF spam blocked by CleanTalk