4 ms·
Fun fact: bash's $RANDOM never yields the same value twice in a row: $ for i in {1..999999}; do echo $((RANDOM-RANDOM)); done | sort -nu | grep -E '^-?.$'
by jwilk 4y ago
Fun fact: bash's $RANDOM never yields the same value twice in a row:
$ for i in {1..999999}; do echo $((RANDOM-RANDOM)); done | sort -nu | grep -E '^-?.$'
-9
-8
-7
-6
-5
-4
-3
-2
-1
1
2
3
4
5
6
7
8
9
- deleted 4y ago[deleted]
- mywittyname 4y agoMaths isn't my background, but isn't this a serious flaw with the quality of the pseudo-random numbers it generates? I remember learning about the enigma machine and how it had a flaw where a letter could not be transformed into itself. And knowing that, for example, an A could never be a A was critical to cracking the enigma code. Because of that knowledge, my cryptographic intuition is that any seemingly minor fact like this could actually be a critical flaw.
- jwilk 4y agoI doubt it matters much. Bash's $RANDOM is implemented using a linear congruential generator, which is not suitable for cryptographic applications anyway.
- deleted 4y ago[deleted]