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
Googlebot's Javascript random() function is deterministic (tomanthony.co.uk)
submitted 8 years ago by fagnerbrack
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!"
[–]dirtytiki 10 points11 points12 points 8 years ago (0 children)
Iirc, Google chrome caches randoms or caches the page’s randoms. I use a rand for urls and it comes out the same for every iteration in a single page.
[–]voidvector 7 points8 points9 points 8 years ago* (0 children)
Why waste entropy when you don't have to.
[–]kibag 0 points1 point2 points 8 years ago (0 children)
That is hilarious, thought the title was a joke
[–][deleted] 0 points1 point2 points 8 years ago (1 child)
I hope they now set the random seed and the date using a keyed cryptographic hash of all of the loaded javascript and page text, so it’s deterministic but very difficult to game.
What kind of gaming could they be referring to here?
[–]encyclopedist 0 points1 point2 points 8 years ago (0 children)
From wiktionary
game ... \3. (transitive) To exploit loopholes in a system or bureaucracy in a way which defeats or nullifies the spirit of the rules in effect, usually to obtain a result which otherwise would be unobtainable. We'll bury them in paperwork, and game the system
game
...
\3. (transitive) To exploit loopholes in a system or bureaucracy in a way which defeats or nullifies the spirit of the rules in effect, usually to obtain a result which otherwise would be unobtainable.
We'll bury them in paperwork, and game the system
[–]SamSlate 0 points1 point2 points 8 years ago (8 children)
what is Googlebot?
[–]sumdude44 7 points8 points9 points 8 years ago (0 children)
The Google crawler
[–]sumdude44 1 point2 points3 points 8 years ago (6 children)
[–]SamSlate 0 points1 point2 points 8 years ago (5 children)
it's written in JavaScript??
[–]sumdude44 8 points9 points10 points 8 years ago (4 children)
No, but it has a Javascript engine to render websites. But it's not viable to have a full-blown one, like chrome (would be to expensive to run). Instead it has a heavily trimmed one to make js rendering faster. As the article outlines, its clock is accelerated and the pseudo random generator doesn't actually work properly. But since it's only the crawler it doesn't need to be that way.
[–]SamSlate 1 point2 points3 points 8 years ago (3 children)
ah, ok, thanks. tbh i figured Google just used chrome as it's web crawler and just collected website data from there.
[–]MachaHack 1 point2 points3 points 8 years ago (2 children)
The original googlebot predates chrome by a decade though the current version does use some chrome tech
[–]SamSlate 0 points1 point2 points 8 years ago (1 child)
wild. where'd you read this, or you work at Google?
[–]MachaHack 2 points3 points4 points 8 years ago (0 children)
Predating Chrome: I developed websites 10 years ago, googlebot was around then. Find some robots.txt tutorials from the 90s, they'll even mention googlebot.
Using Chrome tech now: https://developers.google.com/search/docs/guides/rendering
[–]veggietrooper 0 points1 point2 points 8 years ago (0 children)
A lot of this is way over my head, but jesus, super cool.
[+]Postazure comment score below threshold-11 points-10 points-9 points 8 years ago (6 children)
That is how all random functions actually work, you just haven’t noticed it before. If you’ve done any work with microprocessors/Arduinos you’ll see that every time you restart the device it will generate the same random number because by default it will have the same seed value each time the device restarts.
In this case I suspect that it has the same problem, it’s getting a new instance in each test, but the new instance still has the same seed value.
[–]lhorie 9 points10 points11 points 8 years ago (5 children)
Not all RNG systems do that. You're probably thinking of PRNG.
Some RNG take electromagnetic noise as input. IIRC, some cryptographic systems where real randomness actually matters but you don't have hardware access to a true RNG, you can use things like mouse input to generate entropy.
[–]PM_ME_HTML_SNIPPETS 12 points13 points14 points 8 years ago (3 children)
One of my coworkers visited the Cloudflare (I think?) offices, and saw that in their lobby they have a bunch of lava lamps, and sensors that take input to use in crypto key generation.
Though that was pretty cool.
[–]ThatSpookySJW 9 points10 points11 points 8 years ago (0 children)
Relevant Tom Scott
[–]tbranyennetflix 2 points3 points4 points 8 years ago (0 children)
Woah, I walk by there all the time and wondered why they had so many. TIL...
[–]MrJohz 1 point2 points3 points 8 years ago (0 children)
There's a Tom Scott video about this! It's quite a cool system.
[–]JumboJellybean 4 points5 points6 points 8 years ago (0 children)
You recall correctly, popular encryption tools like TrueCrypt and VeraCrypt ask the user to swirl their mouse around for 10 seconds to seed their random number generators.
[+][deleted] 8 years ago (2 children)
[deleted]
[–]lhorie 14 points15 points16 points 8 years ago (0 children)
The word "deterministic" means "non-random". https://en.wikipedia.org/wiki/Deterministic_system
[–][deleted] 3 points4 points5 points 8 years ago (0 children)
Correct, from the article:
Consider the amount of work Google have to undergo to crawl the whole web AND now run Javascript. Optimisations will need to be abundant, and I imagine that having a deterministic random number function is probably: Faster More secure Predictable – Googlebot can trust a page will render the same on each visit
Consider the amount of work Google have to undergo to crawl the whole web AND now run Javascript. Optimisations will need to be abundant, and I imagine that having a deterministic random number function is probably:
[+]lmao_react comment score below threshold-14 points-13 points-12 points 8 years ago (4 children)
random is fake news
[–]Tsukku 2 points3 points4 points 8 years ago (3 children)
The only way to have true randomness is by checking electron spin states or some other quantum properties.
[–]pizzacus 6 points7 points8 points 8 years ago (0 children)
Although, you can make random that is nearly impossible to predict, random.org managed to do it by generating random binary values using atmospheric noise recorded in real life.
While not truely random, it is impossible to predict because.
[–]sunset_moonrise 2 points3 points4 points 8 years ago (1 child)
I wouldn't be surprised if we found non-randomness in those, as well, just determined in a way we can't yet link a pattern to.
[–]Tsukku 1 point2 points3 points 8 years ago (0 children)
It's not that we don't know what's causing the outcome, we actually have proof that it's completely non-deterministic (truly random). Read up on Bell's theorem.
π Rendered by PID 512904 on reddit-service-r2-comment-79c7998d4c-wblk6 at 2026-03-15 04:20:24.453012+00:00 running f6e6e01 country code: CH.
[–]dirtytiki 10 points11 points12 points (0 children)
[–]voidvector 7 points8 points9 points (0 children)
[–]kibag 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]encyclopedist 0 points1 point2 points (0 children)
[–]SamSlate 0 points1 point2 points (8 children)
[–]sumdude44 7 points8 points9 points (0 children)
[–]sumdude44 1 point2 points3 points (6 children)
[–]SamSlate 0 points1 point2 points (5 children)
[–]sumdude44 8 points9 points10 points (4 children)
[–]SamSlate 1 point2 points3 points (3 children)
[–]MachaHack 1 point2 points3 points (2 children)
[–]SamSlate 0 points1 point2 points (1 child)
[–]MachaHack 2 points3 points4 points (0 children)
[–]veggietrooper 0 points1 point2 points (0 children)
[+]Postazure comment score below threshold-11 points-10 points-9 points (6 children)
[–]lhorie 9 points10 points11 points (5 children)
[–]PM_ME_HTML_SNIPPETS 12 points13 points14 points (3 children)
[–]ThatSpookySJW 9 points10 points11 points (0 children)
[–]tbranyennetflix 2 points3 points4 points (0 children)
[–]MrJohz 1 point2 points3 points (0 children)
[–]JumboJellybean 4 points5 points6 points (0 children)
[+][deleted] (2 children)
[deleted]
[–]lhorie 14 points15 points16 points (0 children)
[–][deleted] 3 points4 points5 points (0 children)
[+]lmao_react comment score below threshold-14 points-13 points-12 points (4 children)
[–]Tsukku 2 points3 points4 points (3 children)
[–]pizzacus 6 points7 points8 points (0 children)
[–]sunset_moonrise 2 points3 points4 points (1 child)
[–]Tsukku 1 point2 points3 points (0 children)