From 3d6a68727182c05fbbef9ad9e694f2e79b6731de Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Thu, 14 Sep 2017 15:43:45 +0200 Subject: Update link text to algorithms homepage --- lib/stdlib/doc/src/rand.xml | 77 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 67 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/stdlib/doc/src/rand.xml b/lib/stdlib/doc/src/rand.xml index e06d7e467d..563ca0b268 100644 --- a/lib/stdlib/doc/src/rand.xml +++ b/lib/stdlib/doc/src/rand.xml @@ -35,12 +35,19 @@ rand Pseudo random number generation. -

This module provides a random number generator. The module contains - a number of algorithms. The uniform distribution algorithms use the - scrambled Xorshift algorithms by - Sebastiano Vigna. The normal distribution algorithm uses the - Ziggurat Method by Marsaglia - and Tsang.

+

+ This module provides a pseudo random number generator. + The module contains a number of algorithms. + The uniform distribution algorithms use the + + xoroshiro116+ and xorshift1024* algorithms by Sebastiano Vigna. + + The normal distribution algorithm uses the + + Ziggurat Method by Marsaglia and Tsang + + on top of the uniform distribution algorithm. +

For some algorithms, jump functions are provided for generating non-overlapping sequences for parallel computations. The jump functions perform calculations @@ -393,9 +400,34 @@ tests. We suggest to use a sign test to extract a random Boolean value. Return a random float. -

Returns a random float uniformly distributed in the value +

+ Returns a random float uniformly distributed in the value range 0.0 =< X < 1.0 and - updates the state in the process dictionary.

+ updates the state in the process dictionary. +

+

+ The generated numbers are on the form N * 2.0^(-53), + that is; equally spaced in the interval. +

+ +

+ This function may return exactly 0.0 which can be + fatal for certain applications. If that is undesired + you can use (1.0 - rand:uniform()) to get the + interval 0.0 < X =< 1.0. +

+

+ If neither endpoint is desired you can test and re-try + like this: +

+
+my_uniform() ->
+    case rand:uniform() of
+        0.0 -> my_uniform();
+	X -> X
+    end
+end.
+
@@ -414,9 +446,34 @@ tests. We suggest to use a sign test to extract a random Boolean value. Return a random float. -

Returns, for a specified state, random float +

+ Returns, for a specified state, random float uniformly distributed in the value range 0.0 =< - X < 1.0 and a new state.

+ X < 1.0 and a new state. +

+

+ The generated numbers are on the form N * 2.0^(-53), + that is; equally spaced in the interval. +

+ +

+ This function may return exactly 0.0 which can be + fatal for certain applications. If that is undesired + you can use (1.0 - rand:uniform(State)) to get the + interval 0.0 < X =< 1.0. +

+

+ If neither endpoint is desired you can test and re-try + like this: +

+
+my_uniform(State) ->
+    case rand:uniform(State) of
+        {0.0, NewState} -> my_uniform(NewState);
+	Result -> Result
+    end
+end.
+
-- cgit v1.2.3