Author Topic: Random Number Generation  (Read 1882 times)


  • Guest
Random Number Generation
« on: 14 Aug 2003, 02:02 »
Is there a plugin or a standard function for generating a Random number? ???

Dr Snark

  • The Doctor Is in!
Re:Random Number Generation
« Reply #1 on: 14 Aug 2003, 02:34 »
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.


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



  • I'm Terran Riiiick!
    • I can help with characters
    • I can help with proof reading
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
    • TerranRich worked on one or more games that was nominated for an AGS Award!
Re:Random Number Generation
« Reply #2 on: 14 Aug 2003, 07:18 »

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...