Posts: 1,648
Threads: 482
Joined: Jun 2010
pawn Код:
public RandomEx(min, max)
{
return random(max - min) + min;
}
I noticed an issue that this won't include the maximum amount i.e
If I do RandomEx(1, 2) it will only be 1. How can I make it include 2 as well?
Posts: 11,827
Threads: 33
Joined: Dec 2011
Reputation:
0
max + 1 when calling the function would solve this but that's how it should actually be. Random will always generate from 0 to max-1
Posts: 1,648
Threads: 482
Joined: Jun 2010
Ahhhh! I see. That is exactly why! I resolved this issue with that. I couldn't figured out why though, but that's right. Random is from 0! Thank you!