Check procents %
#7

Something like this?

PHP код:
CalculateProc(value)
{
    return (
<= random(100) < value) ? 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)
Reply


Messages In This Thread
Check procents % - by Banditukas - 08.06.2015, 07:02
Re: Check procents % - by Rabea - 08.06.2015, 07:28
Re: Check procents % - by Banditukas - 08.06.2015, 08:59
Re: Check procents % - by dominik523 - 08.06.2015, 09:07
Re: Check procents % - by Konstantinos - 08.06.2015, 10:16
Re: Check procents % - by Banditukas - 08.06.2015, 10:48
Re: Check procents % - by Konstantinos - 08.06.2015, 11:24
Re: Check procents % - by ikey07 - 08.06.2015, 11:33

Forum Jump:


Users browsing this thread: 1 Guest(s)