thats the question :
is possible this ? ; selecting a number betewenn 0 and 100 , but excluding for example the 5 or a list.
Phaser.Math.RND.integerInRange(0, 100, "except number 5");
thks in advance
thats the question :
is possible this ? ; selecting a number betewenn 0 and 100 , but excluding for example the 5 or a list.
Phaser.Math.RND.integerInRange(0, 100, "except number 5");
thks in advance
Maybe with a do while loop?
const except = [5,7,8,9]
let randomNumber
do {
randomNumber = Phaser.Math.RND.integerInRange(0,10)
} while (except.includes(randomNumber))
Don’t know if it works, I’m on my phone
Another option, if you don’t want a (potentially) infinite loop in your code, is to generate an array with all the numbers between 0 and 100, except for the numbers you don’t want, and then use the pick
method to get a random value out of that array.
Much better than my solution
thks guys
I had a : do… while . but I am going to check “pick function”
have a nice day …