Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | justflying | |
Old Version | Published before Godot 3 was released. |
func lotgen(a):
var list =Array(range(1,45))
for i in range(a.size()):
var x = randi() % 45 + 1
a[i].append(list[x])
list.remove(x)
return a
Fisher–Yates shuffle - Wikipedia
fisher-yates algorithm might fancy you.
if you want to go crazy, you can take a look at Spotify’s shuffling algorithm
https://labs.spotify.com/2014/02/28/how-to-shuffle-songs/
hungrymonkey | 2017-11-17 18:00