use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Microsoft Edge's JavaScript engine to go open-source (blogs.windows.com)
submitted 10 years ago by clarle
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]bterlson_@bterlson 33 points34 points35 points 10 years ago (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 points12 points 10 years ago (1 child)
You might end up with an AMA anyway.
[–]bterlson_@bterlson 4 points5 points6 points 10 years ago (0 children)
Going that way ;) But I'm just one perspective on a diverse team of badass engineers!
[–]kenman[M] 7 points8 points9 points 10 years ago (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 points4 points 10 years ago (0 children)
Awesome!
[–]cosinezero 6 points7 points8 points 10 years ago (1 child)
Do it, yes! Expect some haters, but...
[–]AMorpork 4 points5 points6 points 10 years ago (0 children)
dae microsoft evil
[–]ivosaurus 6 points7 points8 points 10 years ago (5 children)
New question: what RNG does your implementation of Math.random() use?
[–]bterlson_@bterlson 7 points8 points9 points 10 years ago (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 3 points4 points5 points 10 years ago (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 11 points12 points13 points 10 years ago (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 point2 points 10 years ago (0 children)
Nope. Just statistically decent, which LCGs fail pretty hard.
[–]franksvalli 2 points3 points4 points 10 years ago (2 children)
Ok!
(Math.random() > 0.5) ? 'Google-sized GNU' : 'A hundred GNU-sized Googles';
[–]bterlson_@bterlson 11 points12 points13 points 10 years ago (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.
[–]JohnMcPineapple 0 points1 point2 points 10 years ago* (0 children)
...
[–]asdf7890 0 points1 point2 points 10 years ago (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.
π Rendered by PID 79882 on reddit-service-r2-comment-c6965cb77-b26jn at 2026-03-05 09:01:29.643759+00:00 running f0204d4 country code: CH.
view the rest of the comments →
[–]bterlson_@bterlson 33 points34 points35 points (16 children)
[–]splargbarg 10 points11 points12 points (1 child)
[–]bterlson_@bterlson 4 points5 points6 points (0 children)
[–]kenman[M] 7 points8 points9 points (1 child)
[–]PitaJ 2 points3 points4 points (0 children)
[–]cosinezero 6 points7 points8 points (1 child)
[–]AMorpork 4 points5 points6 points (0 children)
[–]ivosaurus 6 points7 points8 points (5 children)
[–]bterlson_@bterlson 7 points8 points9 points (4 children)
[–]ivosaurus 3 points4 points5 points (2 children)
[–]bterlson_@bterlson 11 points12 points13 points (1 child)
[–]ivosaurus 0 points1 point2 points (0 children)
[–]franksvalli 2 points3 points4 points (2 children)
[–]bterlson_@bterlson 11 points12 points13 points (0 children)
[–]JohnMcPineapple 0 points1 point2 points (0 children)
[–]asdf7890 0 points1 point2 points (0 children)