home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
utilities
/
p
/
python
/
pyhtmldoc
/
r
/
rand
next >
Wrap
Text File
|
1996-11-14
|
982b
|
23 lines
<TITLE>rand -- Python library reference</TITLE>
Next: <A HREF="../w/whrandom" TYPE="Next">whrandom</A>
Prev: <A HREF="../m/math" TYPE="Prev">math</A>
Up: <A HREF="../m/miscellaneous_services" TYPE="Up">Miscellaneous Services</A>
Top: <A HREF="../t/top" TYPE="Top">Top</A>
<H1>5.2. Standard Module <CODE>rand</CODE></H1>
This module implements a pseudo-random number
generator with an interface similar to <CODE>rand()</CODE> in C.
the following functions:
<P>
<DL><DT><B>rand</B> () -- function of module rand<DD>
Returns an integer random number in the range [0 ... 32768).
</DL>
<DL><DT><B>choice</B> (<VAR>s</VAR>) -- function of module rand<DD>
Returns a random element from the sequence (string, tuple or list)
<VAR>s</VAR>.
</DL>
<DL><DT><B>srand</B> (<VAR>seed</VAR>) -- function of module rand<DD>
Initializes the random number generator with the given integral seed.
When the module is first imported, the random number is initialized with
the current time.
</DL>