This process will shuffle any list you give it, effectively and efficiently (for DM). Only shuffle once. If you shuffle the same list twice you're doing extra work that doesn't help.
proc
shuffle(list/givenList)
. = givenList
var/nextElement
for(var/i = 1; i <= givenList.len; i++)
nextElement = rand(1, givenList.len - i)
nextElement = givenList[nextElement]
. -= nextElement
. += nextElement
return .
An example of how it's used:
mob
Login()
var/list/L = list("a","b","c","d")
L = shuffle(L)
for(var/i = 1; i <= L.len; i++)
world << "\[[L[i]]]"
Output
[c]
[a]
[b]
[d]