News for hackers. Stuff that matters.
Re:Latacora: Security Programs For Startups by ShaneWilton on Friday September 23, 2016 @05:49PM (#12568225)
The output of Math.random also doesn't seem to be very uniform. With the original code, I'm consistently seeing Erin appear first 60% of the time, and Thomas first 30% of the time. Jeremy is left with 10%.

Even after changing the code to multiply by 99 instead of 100, the results don't change very much at all.

Re:Latacora: Security Programs For Startups by RKoutnik on Friday September 23, 2016 @05:51PM (#12568232)
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

Also repros in node. Fascinating. There goes my afternoon...

Re:Latacora: Security Programs For Startups by thethirdone on Friday September 23, 2016 @06:47PM (#12568489)
The 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.

Re:Latacora: Security Programs For Startups by ShaneWilton on Friday September 23, 2016 @05:58PM (#12568270)
Ha, I was starting to think I was crazy.
Re:Latacora: Security Programs For Startups by RKoutnik on Friday September 23, 2016 @06:35PM (#12568439)
Posting this to trigger HNReplies - See my first comment response to you for the full story.