12.05.2014, 18:34
Using 10 as max in random function will let you to use it as 10, 20 .. 90, 100 percent. And yes, using case 0 is like using 10% for the above example.
However for using 5%, you'll need to change the max to 100 and check if it's the first 5 digits (0-4), then it's 5 percent.
However for using 5%, you'll need to change the max to 100 and check if it's the first 5 digits (0-4), then it's 5 percent.
pawn Код:
switch (random(100))
{
case 0 .. 4:
{
// 5%
}
}