How to make a random number that won't go less than 10000 or higher than 40000?

Ok the title basicly says all, Its been along time since I played around with randomizing numbers and can't rember how to do it.

For example in my script I have this code.

pawn Код:
RobberieInfo[MaxRobLimit] = 40000
RobberieInfo[MinRobLimit] = 10000
I was wondering how I can use them variables and make it pick a random number between them?

pawn Код:
stock RandomEx(min, max) //******
    return random(max - min) + min;
pawn Код:
// Usage:
new random_number = RandomEx(RobberieInfo[MinRobLimit], RobberieInfo[MaxRobLimit]);

EDIT: Late, nvm.
pawn Код:
stock random_between(min, max) { return (min + random(max - min));  }
Use this!

Thanks guys.

Forum Jump:

Users browsing this thread: 1 Guest(s)