30.06.2014, 20:17
First, "random" generates a number between 0 and the number.
Random doesn't work with negative numbers.
And please, tell me what's the result of 1000-1500 ? It's -500.
Try this function to generate a random number contained in a range
Random doesn't work with negative numbers.
And please, tell me what's the result of 1000-1500 ? It's -500.
Try this function to generate a random number contained in a range
PHP код:
stock randomEx(min, max)
{
if(min > max) return -1;
return min + random(max-min);
}