diff options
-rw-r--r-- | README.markdown | 1 | ||||
-rwxr-xr-x | games/rndn | 12 | ||||
-rw-r--r-- | man/man6/rndn.6 | 19 |
3 files changed, 32 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown index 21c88166..fb588424 100644 --- a/README.markdown +++ b/README.markdown @@ -337,6 +337,7 @@ There's some silly stuff in `install-games`: * `kvlt(6)` translates input to emulate a style of typing unique to black metal communities on the internet. +* `rndn(6)` implements an esoteric random number generation algorithm. * `zs(6)` prepends "z" case-appropriately to every occurrence of "s" in the text on its standard input. diff --git a/games/rndn b/games/rndn new file mode 100755 index 00000000..fd7f3813 --- /dev/null +++ b/games/rndn @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# Esoteric random number generator +# <http://dilbert.com/strip/2001-10-25> +for ((seed = RANDOM ** 2, i = 0; i < ${#seed}; i++)) ; do + ((sum += ${seed:i:1})) +done +for ((red = seed-sum; ${#red} > 1; red=redn)) ; do + for ((j = 0, redn=0; j < ${#red}; j++)) ; do + ((redn += ${red:j:1})) + done +done +printf '%u\n' "$red" diff --git a/man/man6/rndn.6 b/man/man6/rndn.6 new file mode 100644 index 00000000..11169f3c --- /dev/null +++ b/man/man6/rndn.6 @@ -0,0 +1,19 @@ +.TH RNDN 6 "June 2016" "Manual page for rndn" +.SH NAME +.B rndn +\- esoteric random number generator +.SH USAGE +.B rndn +.br +business-critical-process -t "$(\fBrndn\fR)" +.SH DESCRIPTION +.B rndn +uses an advanced but somewhat esoteric algorithm derived by Adams (2001) to +return a random number. While it has proven robust in the author's production +usage, its algorithm has not been formally verified. +.SH SEE ALSO +<http://dilbert.com/strip/2001-10-25> +.SH AUTHORS +Tom Ryder <tom@sanctum.geek.nz> +.br +Inspired by discussions with Wade Brown |