17.12.2016, 15:47
PHP код:
randomex(max, exception = -1)
{
if(exception == -1) return random(max);
new r = random(max - 1);
return (r == exception ? r + 1 : r);
}
If your first result was 2 (out of 0-3), it will get a random value of 0-2. If the value is your last value, it will add one, else take that value. If the first value was the maximum value, it cannot be chosen again (hence "max - 1").