How? for example: sometimes is "var=1;" sometimes is "var=2;"
Is it possible?
int var = rand(5);//This will make var equal a random number that can be as low as 0 and as high as 4
float GetRandomNumber(int MIN, int MAX)
{
return rand(MAX - MIN) + MIN + 1;//This will return a random number that is in between MIN and MAX
}
int var = GetRandomNumber(3, 5);//This will set var to equal a random number in between 3 and 5
float GetRandomNumber(int MIN, int MAX)
{
return rand(MAX - MIN + 1) + MIN;//This will return a random number that is in between MIN and MAX
}
foleyjo wrote:Forgive my ignorance but why do you plus 1 at the end of the random function?
Users browsing this forum: No registered users and 1 guest