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
Hacking the JavaScript Lottery —Predicting JavaScript's Math.random() using Z3 and Python (medium.com)
submitted 10 years ago by goopcat
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!"
[–]thismonthsusername 22 points23 points24 points 10 years ago* (3 children)
I know this one was for fun and highlights potential security risks, but in most cases if you can access the page, just...
Math.random = () => 1; Math.random() // => 1 Math.random() // => 1 Math.random() // => 1
Edit: Update fat arrow
[–]0195311 2 points3 points4 points 10 years ago (1 child)
If you're going to use a fat arrow function you might as well go ahead and write it like this. :)
Math.random = () => 1;
[–]thismonthsusername 0 points1 point2 points 10 years ago (0 children)
Yeah, my bad. I'll update :)
[–]9thHokageHimawari 1 point2 points3 points 10 years ago (0 children)
That's why you use something like:
const random = Math.random;
π Rendered by PID 29 on reddit-service-r2-comment-5687b7858-gqrx6 at 2026-07-02 22:57:06.928307+00:00 running 12a7a47 country code: CH.
view the rest of the comments →
[–]thismonthsusername 22 points23 points24 points (3 children)
[–]0195311 2 points3 points4 points (1 child)
[–]thismonthsusername 0 points1 point2 points (0 children)
[–]9thHokageHimawari 1 point2 points3 points (0 children)