random() question
#1

Hello. I've got a question about the random() function.

If I have this:
Код:
new randomnumber = random(1, 4)
Does this mean "randomnumber" has the possibility to be either 1, 2, 3 or 4?
Or does it mean it has the possibility to be 2, 3, 4 or whatever? Thanks in advance
Reply
#2

This may or may not be what you're trying to do, I'm not entirely sure how to pull it off myself.

Код:
new Float:Random[][] =
{
    1,
    2,
    3,
    4
};
Reply
#3

If you want min and max:
Код:
#define randomex(%0,%1) random(%0-%1)+%1
Reply
#4

The correct usage is "random(max)".

https://sampwiki.blast.hk/wiki/Random

The number has the possibility to be either 0, 1, 2 or 3 when 4 is placed as the substitution of "max".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)