I'm making a random number that must not match with others random numbers set before.
//1 ---- first number ------
set @n1 rand(0,20);
//2 ----- second number -------
set @n2 rand(0,20);
if (@n2 == @n1) { // if the number given by set random is equal to @n1
set, @n2 rand(0,20); // set it again
}
else { // if it is different it will save the value to @n2a
set @n2a, @n2
}
//3 ----- third number -------
set @n3 rand(0,20);
if (@n3 == @n1 && @n3 == @n2) { //same as up
set @n3 rand(0,20);
else {
set @n3a, @n3
}
In this code if the value match others value it will be resetted to a new random number. The problem is that it will be resetted only once.. how can I make it returning until the "else" condition is satisfied?
Question
JeffShadow90
hi.
I'm making a random number that must not match with others random numbers set before.
In this code if the value match others value it will be resetted to a new random number. The problem is that it will be resetted only once.. how can I make it returning until the "else" condition is satisfied?
Thanks
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.