summaryrefslogtreecommitdiffstats
path: root/Lib/random.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-42222: Modernize integer test/conversion in randrange() (#23064)Raymond Hettinger2020-12-281-11/+43
|
* bpo-42470: Do not warn on sequences which are also sets in random.sample() ↵masklinn2020-12-191-6/+7
| | | | (GH-23665)
* bpo-41773: Raise exception for non-finite weights in random.choices(). ↵Ram Rachum2020-09-291-1/+3
| | | | (GH-22441)
* random module: Convert a "while 1" to "while True (GH-21700)Raymond Hettinger2020-08-021-1/+1
|
* bpo-41421: Algebraic simplification for random.paretovariate() (GH-21695)Raymond Hettinger2020-08-011-1/+1
|
* Improve code organization for the random module (GH-21161)Raymond Hettinger2020-06-261-177/+176
|
* Small clean-ups for the random module (GH-21038)Raymond Hettinger2020-06-231-30/+27
|
* Minor code clean-ups (GH-20838)Raymond Hettinger2020-06-131-89/+110
|
* bpo-40541: Add optional *counts* parameter to random.sample() (GH-19970)Raymond Hettinger2020-05-081-5/+29
|
* bpo-40465: Deprecate the optional argument to random.shuffle(). (#19867)Raymond Hettinger2020-05-021-0/+4
|
* Simplify choice()'s interaction with the private _randbelow() method (GH-19831)Raymond Hettinger2020-05-011-9/+5
|
* bpo-40286: Remove C implementation of Random.randbytes() (GH-19797)Victor Stinner2020-04-291-0/+6
| | | | | Remove _random.Random.randbytes(): the C implementation of randbytes(). Implement the method in Python to ease subclassing: randbytes() now directly reuses getrandbits().
* bpo-40325: Deprecate set object support in random.sample() (GH-19591)Raymond Hettinger2020-04-191-1/+4
|
* bpo-40282: Allow random.getrandbits(0) (GH-19539)Antoine Pitrou2020-04-171-2/+4
|
* bpo-40286: Add randbytes() method to random.Random (GH-19527)Victor Stinner2020-04-171-0/+7
| | | | | | | | | | | | Add random.randbytes() function and random.Random.randbytes() method to generate random bytes. Modify secrets.token_bytes() to use SystemRandom.randbytes() rather than calling directly os.urandom(). Rename also genrand_int32() to genrand_uint32(), since it returns an unsigned 32-bit integer, not a signed integer. The _random module is now built with Py_BUILD_CORE_MODULE defined.
* bpo-38881: choices() raises ValueError when all weights are zero (GH-17362)Raymond Hettinger2019-11-231-1/+3
|
* bpo-32554: Deprecate hashing arbitrary types in random.seed() (GH-15382)Raymond Hettinger2019-08-221-2/+13
|
* bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700)Serhiy Storchaka2019-06-011-1/+1
|
* bpo-36559: random module: optimize sha512 import (GH-12742)Christian Heimes2019-04-101-1/+8
| | | | | | The random module now prefers the lean internal _sha512 module over hashlib for seed(version=2) to optimize import time. Signed-off-by: Christian Heimes <christian@python.org>
* Convert range to repeat for choices() (#11889)Raymond Hettinger2019-02-161-3/+3
|
* Be consistent about the use of from-imports in random module (GH-11837)Raymond Hettinger2019-02-131-4/+4
| | | Minor code clean-up.
* bpo-35782: Fix error message in randrange (GH-11620)Kumar Akshay2019-01-211-1/+1
| | | https://bugs.python.org/issue35782
* bpo-30561: Sync-up expovariate() and gammavariate code (GH-1934)leodema2018-12-241-4/+1
|
* bpo-35513, unittest: TextTestRunner uses time.perf_counter() (GH-11180)Victor Stinner2018-12-171-2/+2
| | | | | | | TextTestRunner of unittest.runner now uses time.perf_counter() rather than time.time() to measure the execution time of a test: time.time() can go backwards, whereas time.perf_counter() is monotonic. Similar change made in libregrtest, pprint and random.
* Remove unnecessary and over-restrictive type check (GH-10905)Raymond Hettinger2018-12-041-2/+0
|
* Add comments regarding speed/space/entropy trade-offs (GH-10885)Raymond Hettinger2018-12-041-0/+13
|
* Hoist the float conversion out of the inner loop. (GH-10430)Raymond Hettinger2018-11-091-1/+2
| | | Currently, the *n* and *total* variables get converted to floats each time they are multiplied by random(). This minor tweak does the conversion just once and gets a small speedup (approx 3%).
* Minor code refactoring. Compute len() one fewer times on one code path. ↵Raymond Hettinger2018-07-041-4/+4
| | | | (GH-8094)
* bpo-24567: Random subnormal.diff (#7954)Raymond Hettinger2018-06-271-1/+3
| | | | | Handle subnormal weights for choices()
* bpo-33144: Fix choosing random.Random._randbelow implementation. (GH-6563)Serhiy Storchaka2018-05-081-12/+10
| | | | random() takes precedence over getrandbits() if defined later in the class tree.
* bpo-33144: random.Random and subclasses: split _randbelow implementation ↵Wolfgang Maier2018-04-171-14/+38
| | | | (GH-6291)
* bpo-33203: Ensure random.choice always raises IndexError on empty sequence ↵Wolfgang Maier2018-04-051-0/+2
| | | | | | (GH-6338)
* bpo-31482: Missing bytes support for random.seed() version 1 (#3614)Raymond Hettinger2017-09-171-2/+3
| | | bpo-31482: Missing bytes support for random.seed() version 1 #3614
* random_triangular: sqrt() is more accurate than **0.5 (#3317)Raymond Hettinger2017-09-041-1/+1
|
* fix comment (#1798)leodema2017-06-041-1/+1
|
* bpo-16500: Don't use string constants for os.register_at_fork() behavior (#1834)Gregory P. Smith2017-05-291-1/+1
| | | | Instead use keyword only arguments to os.register_at_fork for each of the scenarios. Updates the documentation for clarity.
* bpo-16500: Allow registering at-fork handlers (#1715)Antoine Pitrou2017-05-271-0/+5
| | | | | | | | | | | | * bpo-16500: Allow registering at-fork handlers * Address Serhiy's comments * Add doc for new C API * Add doc for new Python-facing function * Add NEWS entry + doc nit
* Issue #29055: Suppress upstream exception for random.choice()Raymond Hettinger2016-12-271-1/+1
|
* Issue 28475: Improve error message for random.sample() with k < 0. ↵Raymond Hettinger2016-11-211-1/+1
| | | | (Contributed by Francisco Couzo).
* Fix typosRaymond Hettinger2016-11-131-1/+1
|
* Minor code beautificationRaymond Hettinger2016-11-021-2/+1
|
* Issue #18844: Make the various ways for specifing weights produce the same ↵Raymond Hettinger2016-10-291-3/+4
| | | | results.
* Issue #18844: Make the number of selections a keyword-only argument for ↵Raymond Hettinger2016-09-271-1/+1
| | | | random.choices().
* Rename weighted_choices() to just choices()Raymond Hettinger2016-09-071-3/+3
|
* Issue #18844: Add random.weighted_choices()Raymond Hettinger2016-09-071-1/+27
|
* os.urandom() now blocks on LinuxVictor Stinner2016-09-061-9/+0
| | | | | | | Issue #27776: The os.urandom() function does now block on Linux 3.17 and newer until the system urandom entropy pool is initialized to increase the security. This change is part of the PEP 524.
* MergeRaymond Hettinger2016-09-041-3/+5
|\
| * Improve docs for random.seed()Raymond Hettinger2016-09-041-3/+5
| |
* | Minor beautification (turn nested-if into a conjunction).Raymond Hettinger2016-09-011-6/+5
| |
* | MergeRaymond Hettinger2016-08-311-0/+7
|\ \ | |/