diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-03 17:57:47 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-08-03 18:03:38 +1200 |
commit | 8783a7ba4fccb5f8bb178241a98392cb4b6f6f6c (patch) | |
tree | 9323cf3529ba1c809beed46256889b8ee88c6d0d /man | |
parent | Allow numerator and denominator in myb(1) (diff) | |
download | dotfiles-8783a7ba4fccb5f8bb178241a98392cb4b6f6f6c.tar.gz dotfiles-8783a7ba4fccb5f8bb178241a98392cb4b6f6f6c.zip |
Add rnds(1)
Low-quality random seed attempt.
Diffstat (limited to 'man')
-rw-r--r-- | man/man1/rnda.1 | 7 | ||||
-rw-r--r-- | man/man1/rndf.1 | 7 | ||||
-rw-r--r-- | man/man1/rndi.1 | 19 | ||||
-rw-r--r-- | man/man1/rndl.1 | 6 | ||||
-rw-r--r-- | man/man1/rnds.1 | 21 |
5 files changed, 45 insertions, 15 deletions
diff --git a/man/man1/rnda.1 b/man/man1/rnda.1 index 09833927..3c573662 100644 --- a/man/man1/rnda.1 +++ b/man/man1/rnda.1 @@ -8,9 +8,10 @@ arg1 arg2 arg3 .SH DESCRIPTION .B rnda -prints a random choice from the given arguments. It uses rndi(1), which is not -a high-quality random number source. +prints a random choice from the given arguments. It uses rndi(1), which is +probably not a high-quality source, but should differ within seconds and +between runs on most systems. .SH SEE ALSO -rndf(1), rndi(1), rndl(1), rndn(6) +rndf(1), rndi(1), rndl(1), rnds(1), rndn(6) .SH AUTHOR Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/rndf.1 b/man/man1/rndf.1 index a01a1125..f523c3ac 100644 --- a/man/man1/rndf.1 +++ b/man/man1/rndf.1 @@ -11,9 +11,10 @@ .SH DESCRIPTION .B rndf prints the name a random file (excluding dot files) from the given directory, -defaulting to the current directory. It uses rndi(1), which is not a -high-quality random number source. +defaulting to the current directory. It uses rndi(1), which is probably not a +high-quality source, but should differ within seconds and between runs on most +systems. .SH SEE ALSO -rndi(1), rnda(1), rndl(1), rndn(6) +rndi(1), rnda(1), rndl(1), rnds(1), rndn(6) .SH AUTHOR Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/rndi.1 b/man/man1/rndi.1 index b645d504..094a5f62 100644 --- a/man/man1/rndi.1 +++ b/man/man1/rndi.1 @@ -1,20 +1,25 @@ .TH RNDI 1 "August 2016" "Manual page for rndi" .SH NAME .B rndi -\- return a low-quality random integer between two bounds +\- return a low-quality random integer .SH SYNOPSIS .B rndi 0 10 +.br +.B rndi +0 10 "$(rnds)" .SH DESCRIPTION .B rndi returns a random integer ranging from the first argument to the second argument -in a POSIX-compliant way (using awk). +in a POSIX-compliant way (using awk), using the optional third argument as a +seed. .P -The answer returned is low-quality; given some implementations of awk, it may -even return the same result if run within the same second. This should not be -used in any sort of security or statistical context. The author wrote it to -support scripts to choose a random background image from a directory. +The answer returned is low-quality; given some implementations of awk and no +properly random seed, it may even return the same result if run within the same +second. This should not be used in any sort of security or statistical context. +The author wrote it to support scripts to choose a random background image from +a directory. .SH SEE ALSO -rnda(1), rndf(1), rndl(1), rndn(6) +rnda(1), rndf(1), rndl(1), rnds(1), rndn(6) .SH AUTHOR Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/rndl.1 b/man/man1/rndl.1 index e9f697b3..69deb42b 100644 --- a/man/man1/rndl.1 +++ b/man/man1/rndl.1 @@ -13,8 +13,10 @@ command | .B rndl .SH DESCRIPTION .B rndl -prints a random line from its input, using rndi(1) to choose it. +prints a random line from its input, using rndi(1) to choose it. It uses +rndi(1), which is probably not a high-quality source, but should differ within +seconds and between runs on most systems. .SH SEE ALSO -rndi(1), rnda(1), rndf(1), rndn(6) +rndi(1), rnda(1), rndf(1), rnds(1), rndn(6) .SH AUTHOR Tom Ryder <tom@sanctum.geek.nz> diff --git a/man/man1/rnds.1 b/man/man1/rnds.1 new file mode 100644 index 00000000..1e76d9a1 --- /dev/null +++ b/man/man1/rnds.1 @@ -0,0 +1,21 @@ +.TH RNDS 1 "August 2016" "Manual page for rnds" +.SH NAME +.B rnds +\- try to get a random seed +.SH SYNOPSIS +.B rnds +.B rnds +1024 +.SH DESCRIPTION +.B rnds +uses POSIX tools to try and find a random number device on the system and emits +the first field of a cksum(1) based on it as a low-quality random numeric seed. +The only optional argument allows specifying the number of random bytes to +read, defaulting to 32. This is intended as a low-quality seed for rndi(1). +.P +/dev/arandom is tried first, then /dev/urandom, then /dev/random, before the +script gives up and emits nothing. +.SH SEE ALSO +rndi(1), rnda(1), rndf(1), rndl(1), rndn(6) +.SH AUTHOR +Tom Ryder <tom@sanctum.geek.nz> |