1 \section{\module{whrandom
} ---
2 Floating point pseudo-random number generator.
}
3 \declaremodule{standard
}{whrandom
}
5 \modulesynopsis{Floating point pseudo-random number generator.
}
8 This module implements a Wichmann-Hill pseudo-random number generator
9 class that is also named
\code{whrandom
}. Instances of the
10 \code{whrandom
} class have the following methods:
12 \begin{funcdesc
}{choice
}{seq
}
13 Chooses a random element from the non-empty sequence
\var{seq
} and returns it.
16 \begin{funcdesc
}{randint
}{a, b
}
17 Returns a random integer
\var{N
} such that
\code{\var{a
}<=
\var{N
}<=
\var{b
}}.
20 \begin{funcdesc
}{random
}{}
21 Returns the next random floating point number in the range
[0.0 ...
1.0).
24 \begin{funcdesc
}{seed
}{x, y, z
}
25 Initializes the random number generator from the integers
30 When the module is first imported, the random number is initialized
31 using values derived from the current time.
34 \begin{funcdesc
}{uniform
}{a, b
}
35 Returns a random real number
\var{N
} such that
\code{\var{a
}<=
\var{N
}<
\var{b
}}.
38 When imported, the
\code{whrandom
} module also creates an instance of
39 the
\code{whrandom
} class, and makes the methods of that instance
40 available at the module level. Therefore one can write either
41 \code{N = whrandom.random()
} or:
43 generator = whrandom.whrandom()
44 N = generator.random()
48 \seemodule{random
}{generators for various random distributions
}
49 \seetext{Wichmann, B. A. \& Hill, I. D., ``Algorithm AS
183:
50 An efficient and portable pseudo-random number generator'',
51 \emph{Applied Statistics
} 31 (
1982)
188-
190}