home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pyhtmldoc / r / rand next >
Text File  |  1996-11-14  |  982b  |  23 lines

  1. <TITLE>rand -- Python library reference</TITLE>
  2. Next: <A HREF="../w/whrandom" TYPE="Next">whrandom</A>  
  3. Prev: <A HREF="../m/math" TYPE="Prev">math</A>  
  4. Up: <A HREF="../m/miscellaneous_services" TYPE="Up">Miscellaneous Services</A>  
  5. Top: <A HREF="../t/top" TYPE="Top">Top</A>  
  6. <H1>5.2. Standard Module <CODE>rand</CODE></H1>
  7.  This module implements a pseudo-random number
  8. generator with an interface similar to <CODE>rand()</CODE> in C.
  9. the following functions:
  10. <P>
  11. <DL><DT><B>rand</B> () -- function of module rand<DD>
  12. Returns an integer random number in the range [0 ... 32768).
  13. </DL>
  14. <DL><DT><B>choice</B> (<VAR>s</VAR>) -- function of module rand<DD>
  15. Returns a random element from the sequence (string, tuple or list)
  16. <VAR>s</VAR>.
  17. </DL>
  18. <DL><DT><B>srand</B> (<VAR>seed</VAR>) -- function of module rand<DD>
  19. Initializes the random number generator with the given integral seed.
  20. When the module is first imported, the random number is initialized with
  21. the current time.
  22. </DL>
  23.