4 ms·
If there are runs of zeros, this should result in a number greater than 25000: for i in {1..100000}; do echo $((RANDOM % 2))$((RANDOM % 2)); done | grep 00
by mg 3y ago
If there are runs of zeros, this should result in a number greater than 25000:
for i in {1..100000}; do echo $((RANDOM % 2))$((RANDOM % 2)); done | grep 00 | wc
For me, it always comes out very close to 25000.
- kazinator 3y agoHmm. I also tried this with four bit codes: $ for x in $(seq 1 1600000); do \ echo $((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2))$((RANDOM % 2)); \ done | awk ' { hist[$0]++ } END { for (code in hist) print code, hist[code] }' 0100 99668 0101 99832 0110 100026 0111 99837 0000 99899 0001 100451 0010 99846 0011 99980 1000 100246 1001 100182 1010 100116 1011 100383 1100 100014 1101 99470 1110 99535 1111 100515 Doesn't seem like anything deviates too much. If there were excessive runs of 1's and 0's, the 1111 and 0000 codes would be excessively frequent.