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?
Sep 5 2017, 8:49 am
|
|
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.
|
proc 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 |
The code you just linked doesn't make any sense.
var/list/shakednumbers=new/list Is functionally equivalent to: for(var/l in 1 to 4) |
mob/proc/ShakeNumbers(nums) |
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 |