TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

An RNG that runs in your brain

259 点作者 nalgeon超过 1 年前

17 条评论

defrost超过 1 年前
&gt; Marsaglia is most famous for the diehard suite of RNG tests, so he knows his stuff.<p>Fame is relative, for my part Marsaglia is most famous for <i>The Ziggurat Method for Generating Random Variables</i> and <i>numerous</i> other PRNG delights .. the testsuite comes way down the list.<p>* <a href="https:&#x2F;&#x2F;www.jstatsoft.org&#x2F;article&#x2F;view&#x2F;v005i08" rel="nofollow">https:&#x2F;&#x2F;www.jstatsoft.org&#x2F;article&#x2F;view&#x2F;v005i08</a><p>* <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Ziggurat_algorithm" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Ziggurat_algorithm</a><p><i>Once upon a time I made a branchless generator of large blocks of random points on S2 (the surface of a unit sphere) for an astrophysics sim, it was a fun exercise</i>
评论 #39102569 未加载
评论 #39102418 未加载
评论 #39102468 未加载
aredox超过 1 年前
See also: the Solitaire cipher[0] (requires a deck of cards) Geomantic charts[1], which are... kinda binary encoding and shuffling?<p>[0]<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Solitaire_%28cipher%29" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Solitaire_%28cipher%29</a><p>[1]<a href="https:&#x2F;&#x2F;digitalambler.com&#x2F;2020&#x2F;05&#x2F;08&#x2F;how-to-construct-the-shield-chart-of-geomancy&#x2F;" rel="nofollow">https:&#x2F;&#x2F;digitalambler.com&#x2F;2020&#x2F;05&#x2F;08&#x2F;how-to-construct-the-sh...</a><p>Related : how to debias a biased coin[2] (aka. a Von Neumann extractor).<p>It is not exactly the same (randomness extractor vs. PRNG), but there are similarities[3].<p>[2]<a href="https:&#x2F;&#x2F;carlos.bueno.org&#x2F;2011&#x2F;10&#x2F;fair-coin.html" rel="nofollow">https:&#x2F;&#x2F;carlos.bueno.org&#x2F;2011&#x2F;10&#x2F;fair-coin.html</a><p>[3]<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Randomness_extractor" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Randomness_extractor</a><p>I want to take this opportunity to recommend Hillel&#x27;s writing and depth of analysis (on top of the quirkiness of doing it in a weird lang). Compared to the equivalent answers on stackoverflow[4], there is just no comparison.<p>[4]<a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;3919597&#x2F;is-there-a-pseudo-random-number-generator-simple-enough-to-do-in-your-head" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;3919597&#x2F;is-there-a-pseud...</a>
bumbledraven超过 1 年前
This is the most in-depth analysis of Marsaglia&#x27;s mental PRNG I&#x27;ve seen.<p>A question, though. The author writes:<p>&gt; So what other numbers work? ... if n is a good multiplier, then the period of the orbit starting from 1 should be 10n − 2.<p>&gt; (2 3 6 11 15 18 23 27 38 39 42 50 51 62 66 71)<p>&gt; The last interesting number is 18. It has a respectable period of 178 and has every possible digit transition. The downside is that you have to learn the 18 times-table. This isn’t too bad: I internalized it with maybe 10 minutes of practice.<p>Why is 18 the &quot;last&quot; interesting number? The largest number on the list, 71, has a period of 708 (10n − 2). Given that he is willing to memorize the first 10 multiples of a 2-digit number, why didn&#x27;t he choose 71 over 18, which has a period of only 178?<p>The 2-digit transitions for 71 are pretty evenly distributed:<p><pre><code> 7 7 7 7 7 7 7 7 7 7 7 8 7 7 7 7 7 7 7 7 7 7 8 7 7 7 7 7 7 7 7 7 7 8 7 7 7 7 7 7 7 7 7 7 8 7 7 7 7 7 7 7 7 7 7 8 7 7 7 7 7 7 7 7 7 7 8 7 7 7 7 7 7 7 7 7 7 8 7 7 7 7 7 7 7 7 7 7 8 7 7 7 7 7 7 7 7 7 7 7</code></pre>
camel-cdr超过 1 年前
I stumbled over marsaglias usenet post before.<p>One thing this article didn&#x27;t discuss is choosing a seed, I think humans are better at coming up with a single random number than with a sequence of random numbers, but I still like to incorporate some &quot;randomness&quot; from the environment.<p>You can e.g. add the count of something you don&#x27;t know the count of until you count it to the seed. For example: floor tiles in a room, books with the color red in a book shelve, ... you can obviously also throw a coin or something like that, but that&#x27;s a more involved action.<p>If you are really dedicated, then you could mix in some environmental randomness after ever n iterations.
评论 #39102039 未加载
评论 #39103138 未加载
评论 #39111552 未加载
gilbetron超过 1 年前
One I use for random gaming needs, but requires two brains, if I want to emulate a dN die (d6, d10, d20, whatever) is I think of a number between 1 and N, and the other person does the same. Then add them together and mod by N. Works well enough, although you can get into game theory and the results aren&#x27;t very random because we tend to pick certain numbers.<p>Thinking about it, I wonder if both people picking multiple numbers and adding them all up mod N would improve things.
评论 #39105047 未加载
评论 #39104888 未加载
drdrek超过 1 年前
When I want to be random enough I pick a large number than mod by another random number that is bigger then the max option. (mod again in the max number if needed) This seems unpredictable enough I&#x27;ve been unable to see any patterns in it.<p>lets say you need to pick a number from 1 to 20, if you take 1235 and mod 22. mod is easy to do in your head as you can just subtract in steps until you get there. so 50 times 22 is 1100, we are left with 135. 5 * 22 is 110 so we are left with 25. 25 - 22 is 3.<p>I picked 3 and I would be hard pressed to guess it would end up 3.
评论 #39106267 未加载
评论 #39105295 未加载
andrewla超过 1 年前
I often use the Fibonacci numbers mod 10 when I need to do this in my head. It isn&#x27;t great -- odd numbers are twice as frequent (because mod 2 they&#x27;re [1,1,0]) and you get sequences like [7,0,7,7], but easy to keep track of and the cycle is 60 elements long.<p>The other one I use sometimes is the powers of 2 mod 100 and use the leading digit. This gives a cycle length of 20 with a flat distribution.
评论 #39107148 未加载
weinzierl超过 1 年前
This is about an interesting way to produce a pseudo random sequence. From the title I was expecting something a little different, more akin to Diceware [1], but without dice. Thinking of random numbers, but debiasing with John von Neumann&#x27;s method sprung to my mind.<p>[1] <a href="https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Diceware" rel="nofollow">https:&#x2F;&#x2F;en.m.wikipedia.org&#x2F;wiki&#x2F;Diceware</a>
keepamovin超过 1 年前
I&#x27;ve always been partial to Von Neumann&#x27;s middle square method myself.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Middle-square_method" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Middle-square_method</a>
评论 #39103109 未加载
评论 #39103154 未加载
评论 #39105549 未加载
aquafox超过 1 年前
I&#x27;ve memorized the first 130 digits of pi. Should be good enough for most tasks that require a human RNG.
评论 #39103527 未加载
alanbernstein超过 1 年前
Here is my idea: pick a longish phrase of words, &quot;at random&quot;. A song lyric, a book quote, etc. Count the number of words or the number of letters. Apply modulus if necessary. Repeat.
bsza超过 1 年前
We might be bad at generating <i>uniform, independent</i> random numbers, but I submit that we’re still capable of generating <i>some</i> true randomness. Perhaps take the best of both worlds and mix in new entropy at each step? Something like, take the previous 2-digit value, add a &quot;random&quot; digit and generate the next output from that?
zvr超过 1 年前
In case anyone is interested, the sequence of two-digits numbers is shown at <a href="https:&#x2F;&#x2F;imgur.com&#x2F;a&#x2F;sfxepRb" rel="nofollow">https:&#x2F;&#x2F;imgur.com&#x2F;a&#x2F;sfxepRb</a>.
cmiller1超过 1 年前
The math as expressed in English in the original usenet post is ambiguous which confused me for a moment until I figured out what I was doing wrong.<p>&gt; Choose a 2-digit number, say 23, your “seed”.<p>&gt; Form a new 2-digit number: the 10’s digit plus 6 times the units digit.<p>Here&#x27;s where the ambiguity is, I interpreted this as (tens_digit+6)*units_digit so I did (2+6)*3=24<p>&gt; The example sequence is 23 –&gt; 20 –&gt; 02 –&gt; 12 –&gt; 13 –&gt; 19 –&gt; 55 –&gt; 35 –&gt; …<p>24 != 20 so I had to walk back and figure out that they in fact meant tens_digit+(6*units_digit)
librasteve超过 1 年前
in case you were wondering, raku DOES have built in proper random number generation: &gt; (^6).roll #picks a random number from range 0..5
DeathArrow超过 1 年前
Why are people bad at coming up with random numbers?
评论 #39102302 未加载
评论 #39101883 未加载
评论 #39101996 未加载
评论 #39104896 未加载
MagicMoonlight超过 1 年前
Maybe we can’t pick random numbers because we’re just LLMs