summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_random.py
Commit message (Collapse)AuthorAgeFilesLines
* Fix py3k warnings in 1/0 in tests. (#4072)Serhiy Storchaka2017-10-221-2/+2
|
* [2.7] bpo-31478: Prevent unwanted behavior in _random.Random.seed() in case ↵Oren Milman2017-10-021-0/+16
| | | | the arg has a bad __abs__() method (GH-3596) (#3845)
* [2.7] bpo-29960 _random.Random corrupted on exception in setstate(). … (#1289)Mariatta2017-05-271-0/+5
| | | (cherry picked from commit 9616a82e7802241a4b74cf7ae38d43c37bf66e48)
* Issue #24620: Random.setstate() now validates the value of state last element.Serhiy Storchaka2015-07-241-0/+5
|
* Issue #22777: Test pickling with all protocols.Serhiy Storchaka2014-12-151-6/+8
|
* Issue 13355: Make random.triangular degrade gracefully when low == high.Raymond Hettinger2014-05-261-1/+1
|
* Issue #19936: Added executable bits or shebang lines to Python scripts whichSerhiy Storchaka2014-01-161-2/+0
| | | | | | requires them. Disable executable bits and shebang lines in test and benchmark files in order to prevent using a random system python, and in source files of modules which don't provide command line interface.
* Issue #19588: Fixed tests in test_random that were silently skipped mostZachary Ware2013-11-261-6/+6
| | | | of the time. Patch by Julian Gindi.
* Revert changes for #13355 by request from Raymond HettingerAndrew Svetlov2013-04-131-28/+1
|
* Issue #13355: Raise ValueError on random.triangular call with invalid params.Andrew Svetlov2013-04-121-1/+28
| | | | Initial patch by Yuriy Senko.
* Issue #17141: random.vonmisesvariate() no more hangs for large kappas.Serhiy Storchaka2013-02-101-2/+32
|
* Issue #17149: Fix random.vonmisesvariate to always return results in [0, ↵Mark Dickinson2013-02-101-0/+14
| | | | 2*math.pi].
* Closes #14591: Random.jumpahead could produce an invalid MT state on 64-bit ↵Mark Dickinson2012-06-301-0/+8
| | | | machines.
* Issue 9816: Random.jumpahead(n) didn't work well for small values of n.Raymond Hettinger2010-09-101-2/+0
|
* Issue #7849: Now the utility ``check_warnings`` verifies if the warnings areFlorent Xicluna2010-03-071-2/+1
| | | | effectively raised. A new utility ``check_py3k_warnings`` deals with py3k warnings.
* Remove unused imports in test modules.Georg Brandl2010-02-071-1/+1
|
* #7092: Silence more py3k warnings. Patch by Florent Xicluna.Ezio Melotti2010-02-031-0/+1
|
* use assert[Not]In where appropriateEzio Melotti2010-01-231-2/+2
|
* Reverting the Revision: 77368. I committed Flox's big patch for tests bySenthil Kumaran2010-01-081-1/+0
| | | | mistake. ( It may come in for sure tough)
* Fixing - Issue7026 - RuntimeError: dictionary changed size during iteration. ↵Senthil Kumaran2010-01-081-0/+1
| | | | Patch by flox
* Silence py3k warning claiming to affect the random moduleAntoine Pitrou2009-10-141-4/+6
|
* convert usage of fail* to assert*Benjamin Peterson2009-06-301-18/+18
|
* Inline coefficients in gamma(). Add reflection formula. Add comments.Raymond Hettinger2009-02-191-10/+18
|
* warnings.catch_warnings() now returns a list or None instead of the customBrett Cannon2008-09-091-1/+1
| | | | | | | | WarningsRecorder object. This makes the API simpler to use as no special object must be learned. Closes issue 3781. Review by Benjamin Peterson.
* Rename math.sum to math.fsumMark Dickinson2008-07-301-1/+1
|
* Improve accuracy of gamma test functionRaymond Hettinger2008-07-191-5/+3
|
* Issue 1681432: Add triangular distribution the random module.Raymond Hettinger2008-03-231-0/+2
|
* Issue #1727780: Support loading pickles of random.Random objects createdMartin v. Löwis2007-12-031-0/+13
| | | | | | on 32-bit systems on 64-bit systems, and vice versa. As a consequence of the change, Random pickles created by Python 2.6 cannot be loaded in Python 2.5.
* Remove test.test_support.guard_warnings_filter.Brett Cannon2007-08-141-1/+1
| | | | | | | | test.test_support.catch_warning is more full-featured and provides the same functionality. Since guard_warnings_filter was added in 2.6 there is no backwards-compatibility issues.
* Bug #1486663: don't reject keyword arguments for subclasses of builtinGeorg Brandl2007-01-211-0/+8
| | | | types.
* Bug #1590891: random.randrange don't return correct value for big numberRaymond Hettinger2006-12-201-0/+8
| | | | Needs to be backported.
* Add test.test_support.guard_warnings_filter . This function returns a contextBrett Cannon2006-12-131-4/+3
| | | | | manager that protects warnings.filter from being modified once the context is exited.
* Another crack at bug #1460340: make random.sample(dict)Tim Peters2006-04-011-2/+18
| | | | work, this time by ugly brute force.
* SF bug #1460340: random.sample can raise KeyErrorRaymond Hettinger2006-03-291-0/+3
| | | | Fix the hit and miss style of testing for sets and dicts.
* Use floor division operator.Raymond Hettinger2004-09-271-1/+1
|
* 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.