207 Commits

Author SHA1 Message Date
Raymond Hettinger
d9dda32040 Reduce overhead on random timings (GH-24455) 2021-02-04 21:36:03 -08:00
Serhiy Storchaka
f066bd94b9 bpo-37319: Improve documentation, code and tests of randrange. (GH-19112) 2021-01-25 23:02:04 +02:00
jonanifranco
f7b5bacd7a bpo-42944 Fix Random.sample when counts is not None (GH-24235) 2021-01-18 10:04:29 -08:00
Setrak Balian
998ae1fa3f bpo-42931: randbytes missing from random.__all__ (GH-24219) 2021-01-15 09:50:42 -08:00
Raymond Hettinger
8f8de7380c No need to test "istep==1" twice. (GH-24064) 2021-01-02 12:09:56 -08:00
Raymond Hettinger
768fa145cf bpo-42772: Step argument ignored when stop is None. (GH-24018) 2021-01-02 10:24:51 -08:00
Raymond Hettinger
a9621bb301 bpo-42222: Modernize integer test/conversion in randrange() (#23064) 2020-12-28 11:10:34 -08:00
masklinn
1e27b57dbc bpo-42470: Do not warn on sequences which are also sets in random.sample() (GH-23665) 2020-12-18 20:33:36 -08:00
Ram Rachum
b0dfc75816 bpo-41773: Raise exception for non-finite weights in random.choices(). (GH-22441) 2020-09-28 18:32:10 -07:00
Raymond Hettinger
6a613f90bf random module: Convert a "while 1" to "while True (GH-21700) 2020-08-02 12:03:32 -07:00
Raymond Hettinger
5c3270939c bpo-41421: Algebraic simplification for random.paretovariate() (GH-21695) 2020-08-01 01:18:26 -07:00
Raymond Hettinger
ef19bad7d6 Improve code organization for the random module (GH-21161) 2020-06-25 17:03:50 -07:00
Raymond Hettinger
26a1ad1c24 Small clean-ups for the random module (GH-21038) 2020-06-22 19:38:59 -07:00
Raymond Hettinger
9db5b8d448 Minor code clean-ups (GH-20838) 2020-06-13 09:46:47 -07:00
Raymond Hettinger
81a5fc38e8 bpo-40541: Add optional *counts* parameter to random.sample() (GH-19970) 2020-05-08 07:53:15 -07:00
Raymond Hettinger
190fac99c5 bpo-40465: Deprecate the optional argument to random.shuffle(). (#19867) 2020-05-02 16:45:32 -07:00
Raymond Hettinger
4168f1e460 Simplify choice()'s interaction with the private _randbelow() method (GH-19831) 2020-05-01 10:34:19 -07:00
Victor Stinner
2d8757758d bpo-40286: Remove C implementation of Random.randbytes() (GH-19797)
Remove _random.Random.randbytes(): the C implementation of
randbytes(). Implement the method in Python to ease subclassing:
randbytes() now directly reuses getrandbits().
2020-04-29 18:49:00 +02:00
Raymond Hettinger
4fe002045f bpo-40325: Deprecate set object support in random.sample() (GH-19591) 2020-04-19 00:36:42 -07:00
Antoine Pitrou
75a3378810 bpo-40282: Allow random.getrandbits(0) (GH-19539) 2020-04-17 19:32:14 +02:00
Victor Stinner
9f5fe7910f bpo-40286: Add randbytes() method to random.Random (GH-19527)
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.
2020-04-17 19:05:35 +02:00
Raymond Hettinger
041d8b48a2 bpo-38881: choices() raises ValueError when all weights are zero (GH-17362) 2019-11-23 02:22:13 -08:00
Raymond Hettinger
d0cdeaab76 bpo-32554: Deprecate hashing arbitrary types in random.seed() (GH-15382) 2019-08-22 09:19:36 -07:00
Serhiy Storchaka
2085bd0877 bpo-37116: Use PEP 570 syntax for positional-only parameters. (GH-13700) 2019-06-01 11:00:15 +03:00
Christian Heimes
d914596a67 bpo-36559: random module: optimize sha512 import (GH-12742)
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>
2019-04-10 13:18:02 -07:00