SA-MP Forums Archive
How to generate random numbers? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to generate random numbers? (/showthread.php?tid=535389)



How to generate random numbers? - Ox1gEN - 03.09.2014

Title ^^


Re: How to generate random numbers? - Stinged - 03.09.2014

random(100);


Re: How to generate random numbers? - Ox1gEN - 03.09.2014

That'll give me?

A random number between 1-99?


Re: How to generate random numbers? - Dignity - 03.09.2014

Yes.


Re: How to generate random numbers? - Stinged - 03.09.2014

Well a random number between 0 and 99. If you want to make a min-max, use this function:
pawn Код:
randMin(min, max) // By ****** (I think)
{
    return random(max - min) + min;
}



Re: How to generate random numbers? - Ox1gEN - 03.09.2014

Quote:
Originally Posted by Stinged
Посмотреть сообщение
Well a random number between 0 and 99. If you want to make a min-max, use this function:
pawn Код:
randMin(min, max) // By ****** (I think)
{
    return random(max - min) + min;
}
Thanks for both of y'all, this is what I was exactly wanting