summaryrefslogtreecommitdiffstats
path: root/Lib/whrandom.py
Commit message (Collapse)AuthorAgeFilesLines
* The third and final doc-string sweep by Ka-Ping Yee.Guido van Rossum2000-02-041-67/+58
| | | | | | | | The attached patches update the standard library so that all modules have docstrings beginning with one-line summaries. A new docstring was added to formatter. The docstring for os.py was updated to mention nt, os2, ce in addition to posix, dos, mac.
* Fixed a few lines that tabnanny complained about (one space before theGuido van Rossum1998-08-101-5/+5
| | | | tabs).
* Introducing randrange([start,] stop [,step]) -- same asGuido van Rossum1998-07-311-1/+41
| | | | | | | | | | | | | | | | choice(range(start, stop, step)) but faster. This addresses the problem that randint() was accidentally defined as taking an inclusive range (how unpythonic). The code is longish because Tim Peters insisted that it reject non-integral arguments while I insisted that it be not much slower than randint(); the compromise satisfies both but is somewhat convoluted. Also changed randint() to be implemented through randrange(). This is a semantic change because old randint() didn't test its arguments for validity. (It also makes randrange() win any contest with randint() :-)
* Add comments explaining thread unsafety of this code.Guido van Rossum1998-05-291-0/+10
|
* Andrew Kuchling writes:Guido van Rossum1998-02-161-1/+1
| | | | | | | | First, the RNG in whrandom.py sucks if you let it seed itself from the time. The problem is the line: t = int((t&0xffffff) | (t>>24)) Since it ORs the two parts together, the resulting value has mostly ON bits. Change | to ^, and you don't lose any randomness.
* Two improvements suggested by Tim Peters: speed up random() since weGuido van Rossum1997-07-101-8/+5
| | | | | know Python integers are at least 32 bits long; and avoid zeros in initial seed value.
* Properly parenthesize a long Boolean combination. Formerly, you couldGuido van Rossum1997-01-021-1/+1
| | | | pass invalid seed values.
* Change the default seeding -- use 8 bits of sub-second precision andGuido van Rossum1996-10-211-1/+2
| | | | fold in the higest 8 bits of the time as well.
* * Lib/whrandom.py: if seed is (0,0,0), initialize from currentGuido van Rossum1994-09-141-9/+9
| | | | time; default seed's arguments to (0,0,0)
* New way of generating .pyc files, thanks to Sjoerd.Guido van Rossum1994-08-291-1/+1
| | | | | | urllib.py: '+' is not always safe (even though the RFC says so :-( ) whrandom.py: throw away top bits of time to avoid overflow on Mac (where times can be negative)
* Merge alpha100 branch back to main trunkGuido van Rossum1994-08-011-10/+4
|
* * Mass change: get rid of all init() methods, in favor of __init__()Guido van Rossum1993-12-171-3/+2
| | | | | | | constructors. There is no backward compatibility. Not everything has been tested. * aiff.{py,doc}: deleted in favor of aifc.py (which contains its docs as comments)
* * More changes due to stricter argument passing rulesGuido van Rossum1993-01-041-1/+1
| | | | | | * Fixed calendar.py, mimetools.py, whrandom.py to cope with time.time() returning a floating point number. (And fix old bug in calendar) * Add recursion level to mainloop.mainloop(), to make it reentrant.
* Misc changes and new modules. whrandom is "objectified". SOCKET.pyGuido van Rossum1992-10-181-37/+68
| | | | is moved to the sgi subdirectory.
* Initial revisionGuido van Rossum1990-10-131-0/+74