Hacker News new | past | comments | ask | show | jobs | submit login
RNG Party Tricks (pcg-random.org)
17 points by JetSpiegel on Nov 29, 2014 | hide | past | favorite | 4 comments



I just read about polynomial counters -- does anyone have a good explanation of these? I've searched a bit but haven't found a good example. http://www.atarimuseum.com/videogames/consoles/2600/Atari_ca...


Finally an answer to the "infinite monkeys on typewriters producing Hamlet" problem.


If you know the character length of the text and it isn't too hard. Take the 26 characters + 6 punctuations and try every possible combination. Hamlet has 31842 words, the average word is 5+1 characters, which gives 191052 characters.

32^191052 == 10^(10^5.458731365078367)

Compared to their result

10^(10^5.198179689961317)


To provide only a small detail, the character's in Project Gutenberg's version of Hamlet are:

    \n\r !&'(),-.1:;?ABCDEFGHIKLMNOPQRSTVWYZ[]abcdefghijklmnopqrstuvwxyz
"J", "U", and "X" aren't in the upper case, but all lower case letters are used.

The punctuation [.'!?] are used in the line: Laer. Drown'd! O where?

The punctuation [&,;] are used in the line: Qu. Aye me; what act, that roares so lowd, & thunders

The punctuation [:-] are used in the line: for and a shrowding-Sheete:

The punctuation [()] are used in the line: Was (as you know) by Fortinbras of Norway,

There are four uses of "1", of the form "1.Play. What speech, my Lord?"

The "[" and "]" are used for editor's corrections, like "...thing so ouer-done, is fro[m] the purpose of Playing, whose...", and needn't be in a copy.

A more precise reckoning would be 26 characters + ~14 other characters.

On the plus side, there are only 167,771 bytes in that document, and that includes multiple spaces and other things which aren't relevant. After all, we know there are "textual differences between various copies of the first folio", so "Hamlet" is a fuzzy concept.

40 ^ 167771 == 10^(10^5.42939566795654)

Add back in the 23 used upper-case characters gives 10^(10^5.4798302603626)

Working in log_10 (log_10 (x) ) makes it hard to really see that the ratio of the last two numbers is 10^18782, and between your estimate and theirs is 10^129735.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: