SA-MP Forums Archive
random(max) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: random(max) (/showthread.php?tid=267038)



random(max) - letters - 07.07.2011

I wonder if this is possible or not:
pawn Код:
random(-50)
And if yes, how is it work? By get a random number from 0 to -50 or how?


AW: random(max) - Nero_3D - 07.07.2011

just put a minus before the return not before the number

pawn Код:
new rand = -random(50);
That will give you a random number from 0 till -49


Re: random(max) - letters - 07.07.2011

So it's not possible?
I can only change the max because I make a costum callback (or Idk what it is called :P). But yeah I can edit my it.
But still I'm wondering is it possible?


Re: random(max) - =WoR=Varth - 07.07.2011

I put:
pawn Код:
printf("%d",random(-10));
inside my OnGameModeInit and the return is 659633043 O.o so I think it's not possible at all.


Re: random(max) - letters - 07.07.2011

Yeah it show me a huge number.


Re: random(max) - Ricop522 - 07.07.2011

I make this, I think this works =P


pawn Код:
stock RandomNegative(random)        //ricop522
{
    new str[0x80], str2[0x80];
    format(str2, sizeof(str2), "-%i", random(random));
    strmid(str,str2,0,strlen(str2),128);
    return str;
}



Re: random(max) - letters - 07.07.2011

Thanks to' but I have my own solution