| General > General Technical Chat |
| Odds seem too high when guessing random zeroes and ones |
| (1/6) > >> |
| RoGeorge:
I've made a trivial Arduino demo that generates pseudorandom 0/1 bits, and lights up a different LED for each (the onboard LED and an extra LED connected at pin 12). --- Code: ---#define EXTRA_LED 12 #define BOARD_LED LED_BUILTIN long randNr; void setup() { // put your setup code here, to run once: Serial.begin(9600); randomSeed(analogRead(0)); pinMode(BOARD_LED, OUTPUT); pinMode(EXTRA_LED, OUTPUT); } void loop() { // put your main code here, to run repeatedly: // blip, blip, blip, random draw digitalWrite(BOARD_LED, 0); digitalWrite(EXTRA_LED, 0); delay(500); for (unsigned char c=0; c < 3; c++) { digitalWrite(BOARD_LED, 0); digitalWrite(EXTRA_LED, 0); delay(190); digitalWrite(BOARD_LED, 1); digitalWrite(EXTRA_LED, 1); delay(10); } digitalWrite(BOARD_LED, 0); digitalWrite(EXTRA_LED, 0); delay(1000); randNr = random(2); switch (randNr) { case 0: digitalWrite(BOARD_LED, 0); digitalWrite(EXTRA_LED, 1); break; case 1: digitalWrite(BOARD_LED, 1); digitalWrite(EXTRA_LED, 0); break; } delay(1500); } --- End code --- The strange thing is that when guessing in advance which LED will light up next, chances of guessing seems too high. Happens to guess correctly 3-4 times in a row, once it was 5 or 6 consecutive good guesses. Only once or twice guessed wrong from the first try. The chances to fail from the first guess should be 50%. :-// Each time only played until the first wrong guess, then forget about it. I've only tried to guess it about 10-20 times or so today, playing only occasionally, each time when the blinking LED happen to distract by accident (it's running non stop on a shelf in the lab). The number of drawings so far is probably too small to be representative, but still, very uncanny odds. ??? I suspect it's some psychological effect, where the odds seems much better than they really are. Does it make any sense what I'm describing here, anybody else ever noticed something similar? |
| ataradov:
This is a very known thing. For short runs random sequences may not "look" random. Guess 100 times and see how you do. But write down the results so it is not skewed by memory. There are videos where people working with statistics try to distinguish sequences coming out of the true RNG and generated by a human to look random. In most cases the biggest tell is long runs of the same outcome, which happens in true randomness a lot, but humans can't bring themselves to do that. "You can't have 7 tails in a row, that's not random". |
| iMo:
--- Quote from: RoGeorge on March 19, 2023, 06:10:20 pm ---..I suspect it's some psychological effect, where the odds seems much better than they really are. Does it make any sense what I'm describing here, anybody else ever noticed something similar? --- End quote --- Sure, it does.. When somebody works with the arduino for too long, he/she starts to think the same way.. >:D |
| Siwastaja:
--- Quote from: ataradov on March 19, 2023, 06:26:41 pm ---There are videos where people working with statistics try to distinguish sequences coming out of the true RNG and generated by a human to look random. In most cases the biggest tell is long runs of the same outcome, which happens in true randomness a lot, but humans can't bring themselves to do that. "You can't have 7 tails in a row, that's not random". --- End quote --- Yeah. We are generating random 32-bit device IDs represented as 8-digit hexadecimals (like A05D31DE). And if you look at these device IDs, more than half of them give you bad vibes, "there must be something wrong with our random number generator". Some have exclusively letters A-F with no digits. Others have numbers only. Some have words like BAD in them. Nearly all seem to have some kind of pattern. This is because human brain is hardwired to detect patterns. Randomness will have patterns, too - just random patterns. |
| Bud:
@imo Gee mate, you really gone wild lately with your country flags. Made me Google for Tokelau today :D |
| Navigation |
| Message Index |
| Next page |