aboutsummaryrefslogtreecommitdiffstats
path: root/man
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-03-25 13:21:19 +0100
committerMattias Andrée <maandree@kth.se>2016-03-25 13:21:19 +0100
commit8dc182ff87cafe3337490bc8db90a67449b9c837 (patch)
treef23e6a63ec1a921270693ecd2b03ddb071ae412c /man
parentRename zsplit_unsigned_fast_small_tainted to zsplit_unsigned_fast_small_auto (diff)
downloadlibzahl-8dc182ff87cafe3337490bc8db90a67449b9c837.tar.gz
libzahl-8dc182ff87cafe3337490bc8db90a67449b9c837.tar.bz2
libzahl-8dc182ff87cafe3337490bc8db90a67449b9c837.tar.xz
zrand: add MODUNIFORM and add tests for QUASIUNIFORM and MODUNIFORM
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'man')
-rw-r--r--man/zrand.319
1 files changed, 19 insertions, 0 deletions
diff --git a/man/zrand.3 b/man/zrand.3
index c7858a1..97100bc 100644
--- a/man/zrand.3
+++ b/man/zrand.3
@@ -48,6 +48,25 @@ range [0,
Generate a integer in the range [0,
.IR max ]
uniformally random.
+.TP
+.B MODUNIFORM
+Slightly faster alternative to
+.BR UNIFORM .
+
+It is not truly uniform. It is biased
+to the lower numbers, but the probably
+if any number is either
+.I p
+or
+.I 2p
+for some parameter-dependent number
+.IR p .
+
+It uses the naïve approach of generating
+a random number and modulation with the maximum
+number. However, this implementation this
+modulation by subtracting with the maximum number
+if the generated number is greater.
.P
It is safe to call
.B zrand