mirror of
https://github.com/Citadel-Station-13/Citadel-Station-13-RP.git
synced 2025-12-09 17:54:15 +00:00
24 lines
309 B
Plaintext
24 lines
309 B
Plaintext
/**
|
|
*
|
|
*/
|
|
/proc/shuffle(list/L)
|
|
if(!L)
|
|
return
|
|
|
|
L = L.Copy()
|
|
|
|
for(var/i=1; i<L.len; i++)
|
|
L.Swap(i, rand(i,L.len))
|
|
return L
|
|
|
|
/**
|
|
* Randomize: Returns nothing and acts on list in place.
|
|
*/
|
|
/proc/shuffle_inplace(list/L)
|
|
if(!L)
|
|
return
|
|
|
|
for(var/i=1, i<L.len, ++i)
|
|
L.Swap(i,rand(i,L.len))
|
|
return L
|