random(max)
#1

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?
Reply
#2

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
Reply
#3

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?
Reply
#4

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.
Reply
#5

Yeah it show me a huge number.
Reply
#6

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;
}
Reply
#7

Thanks to' but I have my own solution
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)