aboutsummaryrefslogtreecommitdiffstats
path: root/man/zrand.3
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-03-01 10:55:20 +0100
committerMattias Andrée <maandree@kth.se>2016-03-01 10:55:20 +0100
commit32b87c5979a0e70994e4db65415ec0a2349c5618 (patch)
treea366f6c46762f349ce8b96439a35ac944021055b /man/zrand.3
parentAdd a number of man pages (diff)
downloadlibzahl-32b87c5979a0e70994e4db65415ec0a2349c5618.tar.gz
libzahl-32b87c5979a0e70994e4db65415ec0a2349c5618.tar.bz2
libzahl-32b87c5979a0e70994e4db65415ec0a2349c5618.tar.xz
Add more man pages
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'man/zrand.3')
-rw-r--r--man/zrand.354
1 files changed, 54 insertions, 0 deletions
diff --git a/man/zrand.3 b/man/zrand.3
new file mode 100644
index 0000000..c7858a1
--- /dev/null
+++ b/man/zrand.3
@@ -0,0 +1,54 @@
+.TH ZRAND 3 libzahl
+.SH NAME
+zrand - Generate random a number
+.SH SYNOPSIS
+.nf
+#include <zahl.h>
+
+void zrand(z_t \fIr\fP, enum zranddev \fIdev\fP, enum zranddist \fIdist\fP, z_t \fImax\fP);
+.fi
+.SH DESCRIPTION
+.B zrand
+generates a random number and stores it in
+.IR r .
+.P
+.I dev
+selects the device
+.B zrand
+uses to generate random bits.
+This value may be either of:
+.TP
+.B FAST_RANDOM
+The fast, non-blocking random number generator.
+This is /dev/urandom on Linux.
+.TP
+.B SECURE_RANDOM
+The secure, blocking random number generator.
+This is /dev/random on Linux.
+.P
+.I dist
+selects the probably distribution of the
+output
+.IR r :
+.TP
+.B QUASIUNIFORM
+Use the method of generation that is often
+recommended for generating uniformally random
+integers. This method has unnecessary
+computational overhead and is not properly
+uniform, but is is guaranteed to run in
+constant time assuming the underlying device
+for random bit generation does.
+
+The generated number if be in the inclusive
+range [0,
+.IR max ].
+.TP
+.B UNIFORM
+Generate a integer in the range [0,
+.IR max ]
+uniformally random.
+.P
+It is safe to call
+.B zrand
+with non-unique parameters.