blob: 5a4df3eb50c53700bc9251e9d6bd5ce14c3deef6 [file] [log] [blame]
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00001\section{Standard Module \sectcode{rand}}
Guido van Rossum571391b1997-04-03 22:41:49 +00002\stmodindex{rand}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00003
Guido van Rossum571391b1997-04-03 22:41:49 +00004The \code{rand} module simulates the C library's \code{rand()}
5interface, though the results aren't necessarily compatible with any
6given library's implementation. While still supported for
7compatibility, the \code{rand} module is now considered obsolete; if
8possible, use the \code{whrandom} module instead.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00009
Guido van Rossum571391b1997-04-03 22:41:49 +000010\begin{funcdesc}{choice}{seq}
11Returns a random element from the sequence \var{seq}.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000012\end{funcdesc}
13
Guido van Rossum571391b1997-04-03 22:41:49 +000014\begin{funcdesc}{rand}{}
15Return a random integer between 0 and 32767, inclusive.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000016\end{funcdesc}
17
18\begin{funcdesc}{srand}{seed}
Guido van Rossum571391b1997-04-03 22:41:49 +000019Set a starting seed value for the random number generator; \var{seed}
20can be an arbitrary integer.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000021\end{funcdesc}
Guido van Rossum571391b1997-04-03 22:41:49 +000022