blob: 9b2c685b03454e7ba5d24dab108e3bf395b510d6 [file] [log] [blame]
Fred Drake295da241998-08-10 19:42:37 +00001\section{\module{rand} ---
2 None}
Fred Drakeb91e9341998-07-23 17:59:49 +00003\declaremodule{standard}{rand}
4
5\modulesynopsis{None}
6
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00007
Guido van Rossum571391b1997-04-03 22:41:49 +00008The \code{rand} module simulates the C library's \code{rand()}
9interface, though the results aren't necessarily compatible with any
10given library's implementation. While still supported for
11compatibility, the \code{rand} module is now considered obsolete; if
12possible, use the \code{whrandom} module instead.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000013
Fred Drake7730cc01997-11-30 05:23:47 +000014
Guido van Rossum571391b1997-04-03 22:41:49 +000015\begin{funcdesc}{choice}{seq}
16Returns a random element from the sequence \var{seq}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000017\end{funcdesc}
18
Guido van Rossum571391b1997-04-03 22:41:49 +000019\begin{funcdesc}{rand}{}
20Return a random integer between 0 and 32767, inclusive.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000021\end{funcdesc}
22
23\begin{funcdesc}{srand}{seed}
Guido van Rossum571391b1997-04-03 22:41:49 +000024Set a starting seed value for the random number generator; \var{seed}
25can be an arbitrary integer.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000026\end{funcdesc}
Guido van Rossum571391b1997-04-03 22:41:49 +000027
Guido van Rossume47da0a1997-07-17 16:34:52 +000028\begin{seealso}
Fred Drakeba0a9892000-10-18 17:43:06 +000029 \seemodule{random}{Python's interface to random number generators.}
30 \seemodule{whrandom}{The random number generator used by default.}
Guido van Rossume47da0a1997-07-17 16:34:52 +000031\end{seealso}