diff options
author | Guido van Rossum <guido@python.org> | 1997-04-03 22:41:49 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-04-03 22:41:49 (GMT) |
commit | 571391b963058d5071a5372a4e55cb20c5476622 (patch) | |
tree | 263330f7ec90621008ae3a6426e284d1dd73805b /Doc/libwhrandom.tex | |
parent | 6191551ad6b122d49878843cb2aab8070f10c180 (diff) | |
download | cpython-571391b963058d5071a5372a4e55cb20c5476622.zip cpython-571391b963058d5071a5372a4e55cb20c5476622.tar.gz cpython-571391b963058d5071a5372a4e55cb20c5476622.tar.bz2 |
New stuff by AMK.
Diffstat (limited to 'Doc/libwhrandom.tex')
-rw-r--r-- | Doc/libwhrandom.tex | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/Doc/libwhrandom.tex b/Doc/libwhrandom.tex index 8ad2339..6094462 100644 --- a/Doc/libwhrandom.tex +++ b/Doc/libwhrandom.tex @@ -1,10 +1,19 @@ \section{Standard Module \sectcode{whrandom}} - \stmodindex{whrandom} -This module implements a Wichmann-Hill pseudo-random number generator. -It defines the following functions: +This module implements a Wichmann-Hill pseudo-random number generator +class that is also named \code{whrandom}. Instances of the +\code{whrandom} class have the following methods: \renewcommand{\indexsubitem}{(in module whrandom)} + +\begin{funcdesc}{choice}{seq} +Chooses a random element from the non-empty sequence \var{seq} and returns it. +\end{funcdesc} + +\begin{funcdesc}{randint}{a\, b} +Returns a random integer \var{N} such that \code{\var{a}<=\var{N}<=\var{b}}. +\end{funcdesc} + \begin{funcdesc}{random}{} Returns the next random floating point number in the range [0.0 ... 1.0). \end{funcdesc} @@ -18,3 +27,16 @@ and When the module is first imported, the random number is initialized using values derived from the current time. \end{funcdesc} + +\begin{funcdesc}{uniform}{a\, b} +Returns a random real number \var{N} such that \code{\var{a}<=\var{N}<\var{b}}. +\end{funcdesc} + +When imported, the \code{whrandom} module also creates an instance of +the \code{whrandom} class, and makes the methods of that instance +available at the module level. Therefore one can write either +\code{N = whrandom.random()} or: +\begin{verbatim} +generator = whrandom.whrandom() +N = generator.random() +\end{verbatim} |