I searched all over the forum and the documentation/wiki of AMXX,
but did not find anything that could answer this question. Nevertheless
for the case that this has been asked before, I am sorry.
My question is, if it is possible to make the random_num function handle
exceptions. For example, I want a random number between 0 and 1000.
Now I, for example, do not want to get the values 3, 55, 76, 102, 123, 666 and 998.
What would I do in order to have these exceptions? Note that these numbers
shall be able to vary and that I do not want to run the same function again and
again until an acceptable result has been generated. However, that would look
like this, but I do not think that it is good:
Code:
public random_0_1000(ex_a,ex_b,ex_c,ex_d,ex_e,ex_f,ex_g)
{
new num=random_num(0,1000)
if(num!=ex_a&&num!=ex_b&&num!=ex_c&&num!=ex_d&&num!=ex_e&&num!=ex_f&&num!=ex_g)
{
return num
}
else
{
random_0_1000()
}
}
If something like the following would work, I would be happy.
Code:
random_num(0,1000,!ex_a,!ex_b,!ex_c,!ex_d,!ex_e,!ex_f,!ex_g)
__________________