Fred Drake | 295da24 | 1998-08-10 19:42:37 +0000 | [diff] [blame] | 1 | \section{\module{rand} --- |
| 2 | None} |
Fred Drake | b91e934 | 1998-07-23 17:59:49 +0000 | [diff] [blame] | 3 | \declaremodule{standard}{rand} |
| 4 | |
| 5 | \modulesynopsis{None} |
| 6 | |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 7 | |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 8 | The \code{rand} module simulates the C library's \code{rand()} |
| 9 | interface, though the results aren't necessarily compatible with any |
| 10 | given library's implementation. While still supported for |
| 11 | compatibility, the \code{rand} module is now considered obsolete; if |
| 12 | possible, use the \code{whrandom} module instead. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 13 | |
Fred Drake | 7730cc0 | 1997-11-30 05:23:47 +0000 | [diff] [blame] | 14 | |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 15 | \begin{funcdesc}{choice}{seq} |
| 16 | Returns a random element from the sequence \var{seq}. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 17 | \end{funcdesc} |
| 18 | |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 19 | \begin{funcdesc}{rand}{} |
| 20 | Return a random integer between 0 and 32767, inclusive. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 21 | \end{funcdesc} |
| 22 | |
| 23 | \begin{funcdesc}{srand}{seed} |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 24 | Set a starting seed value for the random number generator; \var{seed} |
| 25 | can be an arbitrary integer. |
Guido van Rossum | 5fdeeea | 1994-01-02 01:22:07 +0000 | [diff] [blame] | 26 | \end{funcdesc} |
Guido van Rossum | 571391b | 1997-04-03 22:41:49 +0000 | [diff] [blame] | 27 | |
Guido van Rossum | e47da0a | 1997-07-17 16:34:52 +0000 | [diff] [blame] | 28 | \begin{seealso} |
Fred Drake | ba0a989 | 2000-10-18 17:43:06 +0000 | [diff] [blame] | 29 | \seemodule{random}{Python's interface to random number generators.} |
| 30 | \seemodule{whrandom}{The random number generator used by default.} |
Guido van Rossum | e47da0a | 1997-07-17 16:34:52 +0000 | [diff] [blame] | 31 | \end{seealso} |