|
|
|
|
|
by shmuppet
760 days ago
|
|
Just so you can see the bias to early numbers in the distribution: for i in $(seq 1000000); do
echo $[RANDOM%10000];
done | sort -n | uniq -c | sort -rn | gnuplot -e "set terminal dumb; set xtics 1000; plot '< cat' using 0:1 with boxes"
|
|
Compare to the version that discards values over 3e4:
Or the version that uses the 32-bit SRANDOM, which reduces the bias by a factor of 2**17: