summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
Commit message (Collapse)AuthorAgeFilesLines
...
* SF #1027105: HardwareRandom should be renamed OSRandomRaymond Hettinger2004-09-131-4/+4
| | | | | | Renamed the new generator at Trevor's recommendation. The name HardwareRandom suggested a bit more than it delivered (no radioactive decay detectors or such).
* Fulfill Martin's request to use try/except rather than a "look beforeRaymond Hettinger2004-09-051-1/+5
| | | | you leap" approach. Makes the early call to os.urandom() unnecessary.
* SF bug #1022010: Import random failsRaymond Hettinger2004-09-041-3/+6
| | | | | * Complete the previous patch by making sure that the MachineRandom tests are only run when the underlying resource is available.
* Teach the random module about os.urandom().Raymond Hettinger2004-08-301-0/+102
| | | | | * Use it for seeding when it is available. * Provide an alternate generator based on it.
* Add some tests for corner cases.Raymond Hettinger2004-07-091-1/+25
|
* * Migrate set() and frozenset() from the sandbox.Raymond Hettinger2003-11-161-8/+6
| | | | | | | | * Install the unittests, docs, newsitem, include file, and makefile update. * Exercise the new functions whereever sets.py was being used. Includes the docs for libfuncs.tex. Separate docs for the types are forthcoming.
* SF bug #812202: randint is always evenRaymond Hettinger2003-10-051-0/+78
| | | | | | | * Added C coded getrandbits(k) method that runs in linear time. * Call the new method from randrange() for ranges >= 2**53. * Adds a warning for generators not defining getrandbits() whenever they have a call to randrange() with too large of a population.
* SF bug #801342: Bug (documentation or real, your choice) in random.sample.Raymond Hettinger2003-09-061-0/+10
| | | | | | | | | | | | random.sample() uses one of two algorithms depending on the ratio of the sample size to the population size. One of the algorithms accepted any iterable population argument so long as it defined __len__(). The other had a stronger requirement that the population argument be indexable. While it met the documentation specifications which insisted that the population argument be a sequence, it made random.sample() less usable with sets. So, the second algorithm was modified to coerce non-indexable iterables and dictionaries into a tuple before proceeding.
* SF bug #778964: bad seed in python 2.3 randomRaymond Hettinger2003-08-091-1/+1
| | | | | | | The default seed is time.time(). Multiplied by 256 before truncating so that fractional seconds are used. This way, two successive calls to random.seed() are much more likely to produce different sequences.
* SF bug #759889: Pickling of Random is brokenRaymond Hettinger2003-06-241-0/+7
| | | | | * Implement __reduce__() to support pickling. * Add a test case to prove a successful roundtrip through pickle.
* Apply the simplified test_support boilerplate.Raymond Hettinger2003-05-031-6/+4
|
* Simplify ref count test.Raymond Hettinger2003-05-021-3/+3
|
* SF bug #690083: test_random fails sometimesRaymond Hettinger2003-02-211-1/+1
| | | | | | time.sleep(1) sometimes delays for fractionally less than a second resulting in too short of an interval for C's time.time() function to create a distinct seed.
* Add refcount test.Raymond Hettinger2003-02-041-3/+12
|
* * Migrate sample distribution test from random.py to test_random.py.Raymond Hettinger2003-01-171-5/+22
| | | | * Use Sets module to more clearly articulate a couple of tests.
* Move the statistical tests for four distributions into the unittest suite.Raymond Hettinger2003-01-051-0/+41
|
* Add a test case.Raymond Hettinger2003-01-051-0/+19
|
* Test an edge case for sample().Raymond Hettinger2003-01-041-0/+1
|
* SF patch 658251: Install a C implementation of the Mersenne Twister as theRaymond Hettinger2002-12-291-14/+201
| | | | core generator for random.py.
* Get rid of relative imports in all unittests. Now anything thatBarry Warsaw2002-07-231-1/+1
| | | | | | | | | | | imports e.g. test_support must do so using an absolute package name such as "import test.test_support" or "from test import test_support". This also updates the README in Lib/test, and gets rid of the duplicate data dirctory in Lib/test/data (replaced by Lib/email/test/data). Now Tim and Jack can have at it. :)
* random.gauss() uses a piece of hidden state used by nothing else,Tim Peters2002-05-051-0/+19
and the .seed() and .whseed() methods failed to reset it. In other words, setting the seed didn't completely determine the sequence of results produced by random.gauss(). It does now. Programs repeatedly mixing calls to a seed method with calls to gauss() may see different results now. Bugfix candidate (random.gauss() has always been broken in this way), despite that it may change results.