ID:2290726
 
(See the best response by Ter13.)
It's easy to do this but (would I be heavier?)
There is a proper command to mix the contents of a list (I believe it would be very light) (I would spend less cpu)
As: min (value1, value2), round (1,9999), pick(list)

I needed it today in a system and hit the doubt (maybe even worth request freature?)
I do not want ease, but would it be interesting to new programmers?
Have you tested this versus Swap() performance wise? I can't imagine unless your entire game spent a ton of resources shuffling lists, that you'd really run into enough bottlenecks for it to require changing up the normal way of doing things.
Best response
proc
shuffle_list(list/l)
var/len = l.len
for(var/pos in 1 to len)
l.Swap(pos,rand(1,len))


Doesn't really need to be built in, as it's such a basic non-problem that can be solved in so many ways as to escape any meaningful standard.
                            var/list/shakednumbers=new/list
while(shakednumbers.len<4) shakednumbers|=rand(1,4)
for(var/l=1 to 4)
choice=locate(shakednumbers[l],y-3,z)
The code you just linked doesn't make any sense.

var/list/shakednumbers=new/list
while(shakednumbers.len<4) shakednumbers|=rand(1,4)
for(var/l in 1 to 4) //fixed a syntax error here.
choice=locate(shakednumbers[l],y-3,z)


Is functionally equivalent to:

for(var/l in 1 to 4)
choice=locate(rand(1,4),y-3,z)
mob/proc/ShakeNumbers(nums)
var/list/shakednumbers=new/list
while(shakednumbers.len<nums)shakednumbers|=rand(1,nums)
for(var/l=1 to nums) usr<<"Yous list shaked is position[l] [shakednumbers[l]]"
https://scontent.fplu9-2.fna.fbcdn.net/v/t1.0-9/ 21432745_482780468745835_2194424864941852142_n.jpg?oh=dd3907 a2b46ff5030d9c5c6c037d5735&oe=5A5052CA
Eu não vivo em sua mente.

Okay, I understand what you are trying to do.

Your code doesn't work though. Your shuffle is straight up wrong.

This is how you shuffle a list:

http://www.byond.com/forum/?post=2290726#comment23262893

You can't just randomly generate a bunch of indices in a sequence, because of the problem of duplicate entries. rand() doesn't know which ones are taken. Also, since you are using |=, you are winding up excluding portions of the list when generating duplicates.

Your shuffle is just wrong.
It was in the race, I copied and pasted a passage, it was bad
Rush, Speeding, Rush
What a stupid translator
O inglês é uma linguagem muito idiomática. É difícil encontrar um software de tradução preciso.