Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | soulldev |
In GDScript, is it possible to exclude a set of numbers (that’s not in range) from the randi() function ?
Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | soulldev |
In GDScript, is it possible to exclude a set of numbers (that’s not in range) from the randi() function ?
Reply From: | volzhs |
there’s no functionality for it.
that is a very corner case, and you should make a logic for your need.
Reply From: | MZmuda |
Do you mean something like this?
var MaxNumber = 20
var BadNumbers = [0, 2, 3, 5, 7, 11, 13, 17]
var aNumber = 0
while (aNumber in BadNumbers) : aNumber = randi()%MaxNumber
print(aNumber)
Exactly what i want, thank you!
soulldev | 2019-05-01 07:23
You’re very welcome!!!
MZmuda | 2019-05-01 23:50