08.06.2015, 11:24
Something like this?
PHP код:
CalculateProc(value)
{
return (0 <= random(100) < value) ? 1 : 2;
}
pawn Код:
// returns 1 if the random number is in the percentage you specified or else it returns 2
CalculateProc(50); // 50% - 50%
CalculateProc(30); // 30% (returns 1) - 70% (returns 2)
CalculateProc(1); // 1% (returns 1) - 99% (returns 2)