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

Naveen Chawla naveen.chwl at gmail.com
Sun Apr 29 16:34:55 UTC 2018


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 lichter.io> 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 https://stackoverflow.com/a/18650169/3975480 for
> example).
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180429/05241749/attachment.html>


More information about the es-discuss mailing list