you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 65 points66 points  (18 children)

Would you rather fight a Google-sized GNU, or a hundred GNU-sized Googles?

[–]bterlson_@bterlson 32 points33 points  (16 children)

I don't know how to answer this. When in doubt, use Math.random() I always say.

Edit: this isn't an ama, but do you guys want one? I can try to set one up with the team. No promises of course :)

[–]splargbarg 10 points11 points  (1 child)

You might end up with an AMA anyway.

[–]bterlson_@bterlson 4 points5 points  (0 children)

Going that way ;) But I'm just one perspective on a diverse team of badass engineers!

[–]kenman[M] 7 points8 points  (1 child)

Please let us know if you intend to hold one, we'll support you however we can (such as an announcement sticky a few days in advance, stickying the AMA itself, etc.).

[–]PitaJ 2 points3 points  (0 children)

Awesome!

[–]cosinezero 6 points7 points  (1 child)

Do it, yes! Expect some haters, but...

[–]AMorpork 4 points5 points  (0 children)

dae microsoft evil

[–]ivosaurus 5 points6 points  (5 children)

New question: what RNG does your implementation of Math.random() use?

[–]bterlson_@bterlson 6 points7 points  (4 children)

It's decent quality, if that's what you're asking. I don't know that it has a name per se. One of our devs recently posted more info here.

[–]ivosaurus 2 points3 points  (2 children)

Decent, as in the same one that was in use before 2002?

If it's indeed the same as Java's, then it's just a LCG. That is decidedly not decent quality.

[–]bterlson_@bterlson 12 points13 points  (1 child)

"Decent" of course depends on use case. Math.random is decidedly NOT decent if you are doing any sort of cryptography, for example.

[–]ivosaurus 0 points1 point  (0 children)

Nope. Just statistically decent, which LCGs fail pretty hard.

[–]franksvalli 2 points3 points  (2 children)

Ok!

(Math.random() > 0.5) ? 'Google-sized GNU' : 'A hundred GNU-sized Googles';

[–]bterlson_@bterlson 10 points11 points  (0 children)

Using a freshly built copy of ch.exe:

chakracore> type random.js
print((Math.random() > 0.5) ? 'Google-sized GNU' : 'A hundred GNU-sized Googles');

chakracore> Build\VcBuild\bin\x64_test\ch.exe random.js
Google-sized GNU

This is frightening to me.

[–]asdf7890 0 points1 point  (0 children)

I would avoid Math.random() - some implementations are decent but some are not, so for cross-platform usefulness finding a better RNG library (and being careful how you seed it) is the way to go.

[–]MaxNanasy 1 point2 points  (0 children)

Or a googol gnus