HGE:Tutorials:Random Numbers
From GPWiki[edit] Random numbers in HGEHGE includes some random number functions. They are member functions of the HGE class. Access them from the global hge pointer declared at the beginning of the program. Random_Float(float x, float y): Returns a random float between x and y (inclusive). Random_Int(int x, int y): Returns a random integer between x and y (inclusive). Random_Seed(int seed=0): Sets the seed for the random number generator. If the seed is zero or omitted, the current time is used for the seed.
hge->Random_Seed(0); //sets the seed to the current time int randomNum = hge->Random_Int(30, 50); //generates a random number from 30 to 50 Next section: Rectangle Class |


