Proposal: Array.prototype.shuffle (Fisher-Yates)

Isiah Meadows isiahmeadows at
Sun Apr 29 17:01:05 UTC 2018

I think this would be better suited for a library function rather than
a language feature. I could see this also being useful also for
randomized displays, but that's about it. And I'm not sure what an
engine could provide here that a library couldn't - you can't really
get much faster than what's in the language (minus bounds checking,
but the likely frequent cache misses will eclipse that greatly), and
it's not unlocking any real new possibilities.

(Not in TC39, either, BTW.)

Isiah Meadows
me at

Looking for web consulting? Or a new website?
Send me an email and we can get started.

On Sun, Apr 29, 2018 at 12:34 PM, Naveen Chawla <naveen.chwl at> wrote:
> I don't think there's such a thing as "real random" in digital algos, just
> "pseudo random".
> Apart from card games, what's the use case?
> (I'm not in TC39 so I can't vote on this)
> I think that this comes after `toObject(keyCallback)`, `takeWhile`,
> `skipWhile`, and `forEachReturningOriginalArray` in terms of usefulness!
> (and maybe even some others)
> On Sun, 29 Apr 2018 at 18:28 Alexander Lichter <es at> wrote:
>> Hey all!
>> Though this proposal was created more than five years ago, it's still
>> something that should be standardized.
>> As the algorithm is known and an implementation wouldn't take ages,
>> bringing in Array.prototype.shuffle is a low-hanging fruit.
>> Furthermore, it helps to provide a "real" random shuffle mechanism,
>> keeping people away from trying to do implement their own (biased or
>> wrong) algorithm (see for
>> example).
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at
> _______________________________________________
> es-discuss mailing list
> es-discuss at

More information about the es-discuss mailing list