[HN Gopher] How random can you be? (2019)
       ___________________________________________________________________
        
       How random can you be? (2019)
        
       Author : amoghs
       Score  : 113 points
       Date   : 2022-09-11 08:27 UTC (14 hours ago)
        
 (HTM) web link (www.expunctis.com)
 (TXT) w3m dump (www.expunctis.com)
        
       | FartyMcFarter wrote:
       | What's the easiest pseudo-random sequence one can calculate
       | mentally in order to beat this?
        
         | 082349872349872 wrote:
         | No need for pseudo-random; a 6-bit binary counter ought to do
         | it.
         | 
         | (assuming this has the same Achilles' Heel as Shannon's 3-bit
         | machine: https://this1that1whatever.com/miscellany/mind-
         | reader/Shanno... )
        
           | lifthrasiir wrote:
           | If you have an access to the developer console, it is pretty
           | easy to verify:                   (async () => {
           | for (let i = 0; i < 64; ++i) for (let j = 0; j < 6; ++j) {
           | (i >> j & 1 ? captureBtnLeftFunc : captureBtnRightFunc)({
           | preventDefault() {} });                 await new Promise(r
           | => requestAnimationFrame(r));             }         })()
           | 
           | This resulted in 34% correct guess rate after 384 simulated
           | presses.
        
         | variaga wrote:
         | There's a deterministic sequence that will beat it every time,
         | which you can calculate as follows.                 - it
         | assumes your first selection was preceeded by 5 consecutive
         | 'left's       - each press, look at the last 5 bits you
         | selected (for your 1st 5 selections,       include those
         | 'virtual' 5 lefts at the beginning). If you have not entered
         | that sequence of 5 before, select 'right'.   If you have
         | entered that sequence before,  pick the opposite of whatever
         | you selected last time as your next press.
         | 
         | RRRRRRLRRRLRLRLLRRRRLLRRLRRLRLLLRRRLLLRLRRLLRLRLRRRRRRLRRRLRLRL
         | LRLL...
        
         | camel-cdr wrote:
         | This one doesn't really "beat" this, but here is a simple PRNG
         | that you can trivially compute using mental arithmetics
         | proposed by George Marsaglia [1]:
         | 
         | 1. Select an initial random number (seed) between 1 and 58.
         | (This is accomplished by mentally collecting entropy from the
         | environment, e.g. counting a group of objects you don't knew
         | the count of before)
         | 
         | 2. Multiply the least significant digit by 6, add the most
         | significant digit to the result, and use the new result as the
         | next seed/state.
         | 
         | 3. The second digit of the state is your generated pseudorandom
         | number.
         | 
         | 4. Goto 2.                                        Sequence
         | generated by 42:              42 -> 2*6+4=16 -> 6*6+1=37 -> ...
         | 42|16|37|45|34|27|44|28|50|05|03|18|49|58|53|23|20|02|12|13|19|
         | 55|35|33|21          2| 6| 7| 5| 4| 7| 4| 8| 0| 5| 3| 8| 9| 8|
         | 3| 3| 0| 2| 2| 3| 9| 5| 5| 3| 1
         | 
         | [1] "Multiply with carry", George Marsaglia (1994):
         | https://groups.google.com/g/sci.math/c/6BIYd0cafQo/m/Ucipn_5...
         | 
         | Edit: Thanks to lifthrasiir you can try it out your self:
         | (async () => {             let x = 42;             for (let i =
         | 0; i < 10; ++i) {                 for (let j = 0; j < 10; ++j)
         | {                     x = (x / 10) + (x % 10) * 6;
         | (x & 1 ? captureBtnLeftFunc : captureBtnRightFunc)({
         | preventDefault() {} });                 }                 await
         | new Promise(r => requestAnimationFrame(r));             }
         | })()
         | 
         | Edit2: fixed *'s
        
           | silvestrov wrote:
           | You need to escape the * in the formula or indent it as code:
           | 42 -> 2*6+4=16 -> 6*6+1=37 -> ...
        
           | defrost wrote:
           | Ahh, George Marsaglia was one of the great OG's of random ..
           | 
           | For any that like such things and haven't yet seen them, his
           | Ziggurat algorithm family for generating target random
           | distributions dates back to the 60's and was written up ~
           | 2000; the classic is the ZA for a random binomial
           | distribution.
           | 
           | Good approach for the bulk rapid generation of large amounts
           | of distributed random values.
           | 
           | [7] https://www.jstatsoft.org/article/view/v005i08
           | 
           | [2] https://en.wikipedia.org/wiki/Ziggurat_algorithm
        
       | Bakary wrote:
       | Creepily reminiscent of this short story:
       | 
       | https://www.nature.com/articles/436150a
        
         | jadbox wrote:
         | All of Ted Chiang's short stories are incredible. I often
         | reread them, and often get new insights each time I do.
        
       | jwie wrote:
       | This doesn't really test randomness.
       | 
       | It appears that the guessing output is deterministic using your
       | inputs as it's inputs and you could figure out as many
       | consecutive inputs you felt like to produce a specific outcome.
       | For instance 6R1L3R inputs forces the game to "guess" wrong each
       | time. It's not guessing. This isn't a random input, but it's
       | perfectly within a reasonable random distribution. Equally random
       | is 10L, which the guesser will guess right each time.
       | 
       | Losing to the guesser doesn't indicate a lack of random input,
       | nor does guessing the opposite of the guesser indicate
       | randomness.
       | 
       | We can't really generate randomness. Only outcomes consistent
       | with some distribution. It's more of a philosophical point. If
       | you made it it's not random.
        
         | water-your-self wrote:
         | If you can predict bits with greater than 50% accuracy then you
         | have not got a truly random set.
        
       | carlmr wrote:
       | So I did 128 presses and it was 48% right at guessing me. I guess
       | I'm quite random, since ~50% is what you'd expect for an actual
       | coin toss.
        
         | ACow_Adonis wrote:
         | 150 presses and 51% here, just trying with my fingers on my
         | smartphone :)
         | 
         | And now to 200 with 49%. Feeling not so subtley smug.
         | 
         | And now to 400 with 50%. Admit I'm getting bored now.
         | 
         | Now the question I have to answer, is that because of my
         | professional experience and history, something inherent in my
         | mind, or was it...just random?
         | 
         | edit: just consciously trying to be random, not using any
         | deliberate or external tricks.
         | 
         | Second question: what percentage of the population behaves like
         | me and is it qualitatively different from the population that
         | doesn't?
         | 
         | I don't believe I actually am random, but whatever it is i'm
         | doing the results are somewhat statistically unlikely. Is
         | knowledge/experience with randomness itself sufficient to
         | defeat this method?
        
       | amelius wrote:
       | This might come in handy during boxing and other combat sports.
        
       | coldtea wrote:
       | I once wore a smoked herring as a tie to a black suit event.
       | 
       | That's how random I can be!
        
         | femto wrote:
         | There is a style of tie known as a kipper (ie. smoked herring)
         | tie [1]. There is no escape from the numbers! :-)
         | 
         | [1] https://en.wikipedia.org/wiki/Kipper_tie
        
         | Tao3300 wrote:
         | Penguin of doom territory, to be sure.
        
           | halgir wrote:
           | I hope they brought their own spork.
        
       | chamod12 wrote:
        
       | [deleted]
        
       | archi42 wrote:
       | The prediction is deterministic, so you can adapt to it and
       | "beat" it every time. Though intuitively and without looking at
       | the implementation, I obviously am not a good adversary: Lowest I
       | reached was 43% after ~50 inputs, stopped at 47% after 103.
       | 
       | With just tapping "randomly", it was looking good until I got 52%
       | at 250 inputs. From there on it went steep downward: 59% at 500
       | but 57% again at 1000 (I changed how I tapped at the 500 mark;
       | else it would have declined even more).
        
         | ouid wrote:
         | 6 bit maximum period lfsr is probably a nearly perfect
         | adversary for it.
        
       | ouid wrote:
       | 100000100001100010100111101000111001001011011101100110101011111
       | and repeat
        
       | marginalia_nu wrote:
       | I was apparently _extremely_ random by counting in binary
       | 
       | left
       | 
       | right
       | 
       | right left
       | 
       | right right
       | 
       | right left left
       | 
       | right left right
       | 
       | right right left
       | 
       | right right right
       | 
       | right left left left
       | 
       | etc.
        
       | rowanG077 wrote:
       | It's incredibly easy to cheat this since you actually, in real-
       | time, can see the feedback of how random it thinks you are.
        
         | Yajirobe wrote:
         | And how exactly do you use this information?
        
           | rowanG077 wrote:
           | Do a pattern. Once you see that the algorithm guesses
           | correctly often do a different pattern. Repeat. It's really
           | easy to get around 50% this way.
        
           | AlexAndScripts wrote:
           | My method: Keep going right until it says you are wrong more
           | than once. In that scenario, go left. Now go right again, and
           | continue. If it catches on, change it up a little:
           | Continuously switch to the other side when it starts catching
           | on.
           | 
           | I can beat it about 80% of the time with this simple method.
           | You just need to think: What _wouldn 't_ a human do when
           | trying to be "random"?
        
       | TrinaryWorksToo wrote:
       | If you want to hack it, give it a binary de Bruijn sequence with
       | alphabet size k=2. Since it looks to follow whichever pattern
       | already exists, and de bruijn sequences minimize existing
       | patterns, it always beats the game.
       | 
       | I used http://combos.org/bruijn and pressed left for zero and
       | right for one.
       | 
       | Using rule Grandmama creates close to a perfectly straight line
       | up and to the right when you start from the first 1 in the
       | sequence.
       | 
       | Try:
       | 1001000101010011010000110010110110001110101110011110111111000000
       | 
       | where 1 is right and 0 is left.
        
         | float4 wrote:
         | This is cool info, thanks.
         | 
         | > Since it looks to follow whichever pattern already exists,
         | and de bruijn sequences minimize existing patterns, it always
         | beats the game.
         | 
         | I'm pretty sure this isn't true though. A de bruin sequence
         | doesn't guarantee that the _order_ of the n-patterns is random,
         | only that the _number_ of unique n-length patterns is
         | maximized.
         | 
         | Indeed, the algorithm you mention puts n-subsequences with many
         | 0's in the front, and subsequences with many 1's in the back.
         | Sure, every n-length subsequence appears only once, but because
         | the order of the subsequences _does_ follow a predictable
         | pattern, your total sequence is still pretty predictable.
         | 
         | This disparity isn't noticeable when n is small (you chose
         | n=6), so you can comfortably beat the game. But pick a large n
         | and your sequence becomes rather predictable.
         | 
         | Try n=20. In that case, the generated sequence S has length
         | |S|=32,768=2^15. In the first half, there are 9098 0's and 7286
         | 1's. In the second half these numbers are exactly the opposite.
         | Throw this sequence into the game, and you end up with a
         | prediction accuracy of 50%. Not _worse_ than random, but you
         | didn 't beat the game either.
        
           | TrinaryWorksToo wrote:
           | I picked n=6 in particular because the code checks the past 5
           | numbers so 6 means that it can't do its frequency analysis
           | but also avoids the problem you mention. And yes, it isn't
           | random, rather it enforces a unique sequence. Because the
           | code looks for repetition one number at a time, a de bruijn
           | sequence has to be pretty optimal since it attempts not to.
           | 
           | Also this sequence seems to work better: 00000010010001010100
           | 11010000110010110110001110101110011110111111
        
       | machina_ex_deus wrote:
       | At the heart of Bells inequality in physics is the assumption of
       | free will, that the experimentalist is "free" to choose a
       | detector setting.
       | 
       | Yet when faced with the task of actually generating random
       | numbers, humans fail miserably. Some how the failure to generate
       | random numbers isn't seen as a lack of free will by anyone.
       | 
       | But in the context of quantum physics, the experimenters
       | "freedom" to do something most humans can't actually do is a
       | given, and denying it is "super determinism" and anti science.
       | 
       | It's funny that physicist take the freedom of their random
       | choices as a given when a simple experiment shows they don't have
       | such freedom.
        
       | synergy7 wrote:
       | There is an example in Mathematica [1] that illustrates a similar
       | point using Rock-Paper-Scissors game. It uses a very simple
       | strategy to predict human opponent [2], but it appears to work
       | well. (Although, at the moment the demonstration does not seem to
       | be working at all (I tried it in Firefox and Chrome)).
       | 
       | [1].
       | https://demonstrations.wolfram.com/RockPaperScissorsWithAIPl...
       | [2]. https://blog.wolfram.com/2014/01/20/how-to-win-at-rock-
       | paper...
        
       | belter wrote:
       | Nine,nine,nine,nine,nine,nine...
        
       | plank wrote:
       | Tried it. Not being random, I earned some virtual money fast
       | (iteration 39: I guessed left (wrong). You pressed right. My
       | guesses are correct 28% of the time (overall).)
       | https://www.dropbox.com/s/n46fda7nmm0wi0e/20220911_112422.jp...
        
       | seanhandley wrote:
       | potato
        
       | generalizations wrote:
       | I pressed right 6 times in a row. Apparently that's a very random
       | thing to do.
        
         | water-your-self wrote:
         | Its equivalently random to any other sequence!
        
       | ptoo wrote:
       | My solution was to generate random sentences in my head. I then
       | iterate through the letters of each sentence, and if the letter
       | is M or later in the alphabet, I select right. If the letter is
       | before M in the alphabet I select left.
        
         | NeoTar wrote:
         | That's likely to introduce bias because the probability of the
         | two halves aren't equal... My initial instinct would be that
         | the latter half would be less likely (since it has Q, X, Z),
         | but maybe not - as a rule of thumb the most common letters are
         | ETAOIN SHURDL - so 6 from the second half, and 6 from the
         | first.
        
           | tromp wrote:
           | They minimized bias already by splitting 12-14, see my other
           | comment.
        
         | tromp wrote:
         | According to English letter frequencies [1] that gives a right
         | probability of 3.0129+6.6544+7.1635+3.1671+0.1962+7.5809+5.7351
         | +6.9509+3.6308+1.0074+1.2899+0.2902+1.7779+0.2722 = 48.7294 %
         | even though you summed 14 of the 26 letters (a 13-13 split
         | would lower the probability to 45.7165%).
         | 
         | [1]
         | https://www3.nd.edu/~busiforc/handouts/cryptography/letterfr...
        
           | NeoTar wrote:
           | I wonder if the patterns of letters in English language usage
           | would still yield predictable patterns of left-and-right.
           | Like naively 'the' is more common than 'zzz', so right-left-
           | left may be more common than right-right-right.
        
         | InCityDreams wrote:
         | Try it alternating/ varying musical time signatures.
        
         | Tao3300 wrote:
         | I mentally labeled my pulse as _left... right... left...
         | right..._ and whenever I blinked I took that direction. The
         | tricky part is not thinking about what _should_ be next. It 's
         | also a slow way to play, but I was winning until I clicked
         | randomize!
        
         | kqr wrote:
         | This was a nice way to generate random numbers fast! My go-to
         | method is the second hand on the clock, but that's of course
         | highly autocorrelated if you need numbers quickly.
        
       | kristopolous wrote:
       | Adversarially it can be defeated. However, when trying to be
       | faithfully random it does pretty good
        
         | omnicognate wrote:
         | Yeah, it was only 44% right on my 100 presses but I was trying
         | to beat it, not be random. You can sometimes get surprisingly
         | long runs of wrong guesses out of it by repeating your guess
         | once you get a wrong.
        
       | PinkMilkshake wrote:
       | A decent strategy is to use the results of the last click to
       | choose your next click. Win money, click right, lose money, click
       | left.
        
         | randtrain34 wrote:
         | Using a variation of this:
         | 
         | ```
         | 
         | for(let j=0; j<5; j++){
         | window.captureBtnLeftFunc({preventDefault: () => {}})
         | for(let i=0; i<200; i++){                  if
         | (window.prediction == window.lastKey) {
         | window.captureBtnRightFunc({preventDefault: () => {}})
         | } else {
         | window.captureBtnLeftFunc({preventDefault: () => {}})
         | }                }
         | 
         | }
         | 
         | ```
         | 
         | actually got me a pretty linear upward win line for thousands
         | of simulated clicks
        
         | [deleted]
        
         | marcAKAmarc wrote:
         | I did this and by 100, i was +30, but by 200 i was bqck to 0.
        
         | pil0u wrote:
         | Intrigued too. It worked very well for the first 100
         | iterations. Starting iterations 180, I entered a very
         | deterministic loop (6 correct - 1 wrong - repeat), making me a
         | money loser.
        
         | Bakary wrote:
         | This was a really intriguing idea but I failed to get much luck
         | with it...`
        
       ___________________________________________________________________
       (page generated 2022-09-11 23:01 UTC)