Skip to content

Instantly share code, notes, and snippets.

@meereeum
Last active February 23, 2019 04:49
Show Gist options
  • Save meereeum/b417bc4d7d2f6e27c1aa6e15a6a78973 to your computer and use it in GitHub Desktop.
Save meereeum/b417bc4d7d2f6e27c1aa6e15a6a78973 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/bash
# a million random digits with 100,000 normal deviates
[ -f digits.txt ] || (
wget https://www.rand.org/content/dam/rand/pubs/monograph_reports/MR1418/MR1418.digits.txt.zip &&
unzip MR1418.digits.txt.zip)
rando=$( cat digits.txt | cut --complement -f1 -d' ' | xargs | sed 's/ *//g' )
for n in {00..99}; do
echo -e "$n\t$( grep -o $n <<< $rando | wc -l )" # num occurences
done | sort -n -k2,2 --reverse | grep -n --color ^47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment