1 \section{Standard Module
\module{whrandom
}}
2 \label{module-whrandom
}
5 This module implements a Wichmann-Hill pseudo-random number generator
6 class that is also named
\code{whrandom
}. Instances of the
7 \code{whrandom
} class have the following methods:
9 \begin{funcdesc
}{choice
}{seq
}
10 Chooses a random element from the non-empty sequence
\var{seq
} and returns it.
13 \begin{funcdesc
}{randint
}{a, b
}
14 Returns a random integer
\var{N
} such that
\code{\var{a
}<=
\var{N
}<=
\var{b
}}.
17 \begin{funcdesc
}{random
}{}
18 Returns the next random floating point number in the range
[0.0 ...
1.0).
21 \begin{funcdesc
}{seed
}{x, y, z
}
22 Initializes the random number generator from the integers
27 When the module is first imported, the random number is initialized
28 using values derived from the current time.
31 \begin{funcdesc
}{uniform
}{a, b
}
32 Returns a random real number
\var{N
} such that
\code{\var{a
}<=
\var{N
}<
\var{b
}}.
35 When imported, the
\code{whrandom
} module also creates an instance of
36 the
\code{whrandom
} class, and makes the methods of that instance
37 available at the module level. Therefore one can write either
38 \code{N = whrandom.random()
} or:
40 generator = whrandom.whrandom()
41 N = generator.random()
45 \seemodule{random
}{generators for various random distributions
}
46 \seetext{Wichmann, B. A. \& Hill, I. D., ``Algorithm AS
183:
47 An efficient and portable pseudo-random number generator'',
48 \emph{Applied Statistics
} 31 (
1982)
188-
190}