4 ms·
I think it is even worse than I thought... I've asked the "true"-random tool to give me 3000 of the really "true" numbers (as it claims) and out of 3000 it has
by arno1 10y ago
I think it is even worse than I thought...
I've asked the "true"-random tool to give me 3000 of the really "true" numbers (as it claims) and out of 3000 it has thrown to me ~9% of char(0) and ~9% of char(255) values (see the fractions below), whilst the others <0.01% per char between char(1-254).
./generate_constant_stream |head -c3000 |ent -c
Value Char Occurrences Fraction
0 309 0.103000
1 33 0.011000
...
...
253 � 28 0.009333
254 � 29 0.009667
255 � 312 0.104000
Total: 3000 1.000000
Entropy = 6.861709 bits per byte.
Update
Running it without the char(0)/char(255) neither did outperform /dev/urandom, but only running terribly slow (~5mins on i7) and using 100% of a CPU core:
$ ./generate_constant_stream | cat - | sed -u 's/\x00//g;s/\xff//g' |head -c3000 |ent -c
Entropy = 7.737683 bits per byte.
$ cat /dev/urandom | sed -u 's/\x00//g;s/\xff//g' |head -c3000 |ent -c
Entropy = 7.924493 bits per byte.