This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static list<wrapper> randomize(list<wrapper> lst){ | |
integer currentIndex = lst.size(); | |
wrapper temporaryValue; | |
integer randomIndex; | |
// While there remain elements to shuffle... | |
while (0 != currentIndex) { | |
// Pick a remaining element... | |
randomIndex = integer.valueOf(Math.floor(Math.random() * currentIndex)); | |
currentIndex -= 1; | |
// And swap it with the current element. |