From 8dc182ff87cafe3337490bc8db90a67449b9c837 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 25 Mar 2016 13:21:19 +0100 Subject: zrand: add MODUNIFORM and add tests for QUASIUNIFORM and MODUNIFORM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- man/zrand.3 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'man') 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 -- cgit v1.2.3-70-g09d2