21.01.2012, 20:40
How can I select a random number from let's say,1 to 100 ?
Thanks for the help
Thanks for the help
new
number = random( 100 );
stock randomex(min, max)
{
return random(max - min) + min;
}
If you want to randomize between a minimal and a maximal number you can use randomex:
pawn Код:
random(5) can return 0,1,2,3,4,5 while randomex(3,5) can return 3,4,5. |
#define randomex(%1,%2) random(%1 - %2) + %2
new randomnum = random(100) + 1;
//Numbers start at 0 and would go to 99 but we added the +1 so it went from 1 -> 100.