125 Commits

Author SHA1 Message Date
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
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
AMIR
b8fde8b541 bpo-42008: Fix internal _random.Random() seeding for the one argument case (GH-22668) 2020-12-21 15:45:50 -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
Dong-hee Na
6989af0bc7 bpo-41052: Opt out serialization/deserialization for _random.Random (GH-21002) 2020-06-21 18:44:58 +09: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
Raymond Hettinger
4fe002045f bpo-40325: Deprecate set object support in random.sample() (GH-19591) 2020-04-19 00:36:42 -07:00
Serhiy Storchaka
223221b290 bpo-40286: Makes simpler the relation between randbytes() and getrandbits() (GH-19574) 2020-04-17 23:51:28 +03: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
Victor Stinner
278c1e159c bpo-40094: Add test.support.wait_process() (GH-19254)
Moreover, the following tests now check the child process exit code:

* test_os.PtyTests
* test_mailbox.test_lock_conflict()
* test_tempfile.test_process_awareness()
* test_uuid.testIssue8621()
* multiprocessing resource tracker tests
2020-03-31 20:08:12 +02:00
Victor Stinner
00d7cd8ab8 bpo-38075: Fix random_seed(): use PyObject_CallOneArg() (GH-18897)
Fix the random.Random.seed() method when a bool is passed as the
seed.

PyObject_Vectorcall() was misused: use PyObject_CallOneArg() instead.
2020-03-10 15:15:14 +01:00
Raymond Hettinger
041d8b48a2 bpo-38881: choices() raises ValueError when all weights are zero (GH-17362) 2019-11-23 02:22:13 -08:00
Xtreak
a06d683d7f bpo-38120: Fix DeprecationWarning in test_random for invalid type of arguments to random.seed. (GH-15987) 2019-09-12 11:13:20 +03:00
Min ho Kim
96e12d5f4f Fix typos in docs, comments and test assert messages (#14872) 2019-07-21 16:12:33 -04:00
penguindustin
9646630895 bpo-36766: Typos in docs and code comments (GH-13116) 2019-05-06 14:57:17 -04:00
Serhiy Storchaka
5b10b98247 bpo-22831: Use "with" to avoid possible fd leaks in tests (part 2). (GH-10929) 2019-03-05 10:06:26 +02:00
leodema
63d152232e bpo-30561: Sync-up expovariate() and gammavariate code (GH-1934) 2018-12-23 22:54:25 -08:00
Raymond Hettinger
ddf7171911 bpo-24567: Random subnormal.diff (#7954)
Handle subnormal weights for choices()
2018-06-27 01:08:31 -07:00
Serhiy Storchaka
ec1622d56c bpo-33144: Fix choosing random.Random._randbelow implementation. (GH-6563)
random() takes precedence over getrandbits() if defined later
in the class tree.
2018-05-08 15:45:15 +03:00