4 ms·
Interesting, running just the number generation under node v6.5.0 gives: { '0': 340364, '1': 330093, '-1': 329543 } So we see a slight bias for zero (ele
by RKoutnik 10y ago
Interesting, running just the number generation under node v6.5.0 gives:
{ '0': 340364, '1': 330093, '-1': 329543 }
So we see a slight bias for zero (elements are equal) there. ~Lemme try it in Chrome and get back to you.~
AHA, repro'd in Chrome latest: http://jsbin.com/cefuqi/edit?js,console http://jsbin.com/cefuqi/edit?js,console
Also repros in node. Fascinating. There goes my afternoon...
- ShaneWilton 10y agoHa, I was starting to think I was crazy.
- thethirdone 10y agoThe problem is in the sort function. It expects the comparison to be deterministic and thus does not give the fully randomized list. Instead giving each name a distinct value (between 0 and 1) and sort based on those values.