Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | scrubswithnosleeves |
Hey All,
Trying to use the shuffle()
method on an array returns null for me. Here is a simple example:
func _ready():
var nums = [1,2,3,4,5]
print(nums)
print(nums.shuffle())
Output:
[1, 2, 3, 4, 5]
Null
What am I doing wrong? It doesn’t help if I capture it with something like:
numsShuffled = nums.shuffle()
It also doesn’t help if I move it out of the _ready()
function
Am I missing something or do I need to write my own shuffle function?