cpython/Doc/lib/librand.tex

28 lines
832 B
TeX
Raw Normal View History

1994-01-01 21:22:07 -04:00
\section{Standard Module \sectcode{rand}}
\label{module-rand}
1997-04-03 18:41:49 -04:00
\stmodindex{rand}
1994-01-01 21:22:07 -04:00
1997-04-03 18:41:49 -04:00
The \code{rand} module simulates the C library's \code{rand()}
interface, though the results aren't necessarily compatible with any
given library's implementation. While still supported for
compatibility, the \code{rand} module is now considered obsolete; if
possible, use the \code{whrandom} module instead.
1994-01-01 21:22:07 -04:00
1997-04-03 18:41:49 -04:00
\begin{funcdesc}{choice}{seq}
Returns a random element from the sequence \var{seq}.
1994-01-01 21:22:07 -04:00
\end{funcdesc}
1997-04-03 18:41:49 -04:00
\begin{funcdesc}{rand}{}
Return a random integer between 0 and 32767, inclusive.
1994-01-01 21:22:07 -04:00
\end{funcdesc}
\begin{funcdesc}{srand}{seed}
1997-04-03 18:41:49 -04:00
Set a starting seed value for the random number generator; \var{seed}
can be an arbitrary integer.
1994-01-01 21:22:07 -04:00
\end{funcdesc}
1997-04-03 18:41:49 -04:00
\begin{seealso}
\seemodule{whrandom}{the standard Python random number generator}
\end{seealso}