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

Alexander Lichter es at lichter.io
Sun Apr 29 20:01:26 UTC 2018


On 29.04.2018 18:34, Naveen Chawla wrote:
> I don't think there's such a thing as "real random" in digital algos, 
> just "pseudo random".
You are right. I meant 'unbiased' pseudo randomness here.

> Apart from card games, what's the use case?
There are a lot of potential use cases. The best that comes into my mind 
is sampling test data.


On 29.04.2018 19:01, Isiah Meadows wrote:
> 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.
As Tab Atkins Jr. already pointed out it's not about performance 
benefits. It's about how error-prone custom shuffle implementations 
are/can be.


More information about the es-discuss mailing list