172 Commits

Author SHA1 Message Date
Miss Islington (bot)
9ade4cbc0f bpo-35513, unittest: TextTestRunner uses time.perf_counter() (GH-11180)
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.
(cherry picked from commit 8db5b54463)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2018-12-17 02:49:22 -08:00
Miss Islington (bot)
0eaf7b975b bpo-24567: Random subnormal.diff (GH-7954) (GH-7955)
Handle subnormal weights for choices()
(cherry picked from commit ddf7171911)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2018-06-27 01:53:04 -07:00
Miss Islington (bot)
baf304e82e bpo-33203: Ensure random.choice always raises IndexError on empty sequence (GH-6338) (GH-6387)
(cherry picked from commit 091e95e900)

Co-authored-by: Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de>
2018-04-05 09:02:12 -07:00
Raymond Hettinger
132a7d7cdb bpo-31482: Missing bytes support for random.seed() version 1 (#3614)
bpo-31482: Missing bytes support for random.seed() version 1 #3614
2017-09-17 09:04:30 -07:00
Raymond Hettinger
f5ea83f486 random_triangular: sqrt() is more accurate than **0.5 (#3317) 2017-09-04 16:51:06 -07:00
leodema
9f396b605e fix comment (#1798) 2017-06-04 07:41:41 +01:00
Gregory P. Smith
163468a766 bpo-16500: Don't use string constants for os.register_at_fork() behavior (#1834)
Instead use keyword only arguments to os.register_at_fork for each of the scenarios.
Updates the documentation for clarity.
2017-05-29 10:03:41 -07:00
Antoine Pitrou
346cbd351e bpo-16500: Allow registering at-fork handlers (#1715)
* 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
2017-05-27 17:50:54 +02:00
Raymond Hettinger
bb2839b680 Issue #29055: Suppress upstream exception for random.choice() 2016-12-27 01:06:52 -08:00
Raymond Hettinger
bf87126a63 Issue 28475: Improve error message for random.sample() with k < 0. (Contributed by Francisco Couzo). 2016-11-21 14:34:33 -08:00
Raymond Hettinger
24e4239434 Fix typos 2016-11-13 00:42:56 -05:00
Raymond Hettinger
8567e58ae3 Minor code beautification 2016-11-01 22:23:11 -07:00
Raymond Hettinger
30d00e54dd Issue #18844: Make the various ways for specifing weights produce the same results. 2016-10-29 16:55:36 -07:00
Raymond Hettinger
9016f2864a Issue #18844: Make the number of selections a keyword-only argument for random.choices(). 2016-09-26 21:45:57 -07:00
Raymond Hettinger
28aa4a0684 Rename weighted_choices() to just choices() 2016-09-07 00:08:44 -07:00
Raymond Hettinger
e8f1e002c6 Issue #18844: Add random.weighted_choices() 2016-09-06 17:15:29 -07:00
Victor Stinner
e66987e626 os.urandom() now blocks on Linux
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.
2016-09-06 16:33:52 -07:00
Raymond Hettinger
6579502c7e Merge 2016-09-04 11:17:48 -07:00
Raymond Hettinger
16eb827b33 Improve docs for random.seed() 2016-09-04 11:17:28 -07:00
Raymond Hettinger
2f9cc7ab0c Minor beautification (turn nested-if into a conjunction). 2016-08-31 23:00:32 -07:00
Raymond Hettinger
112835cb3e Merge 2016-08-31 15:01:28 -07:00
Raymond Hettinger
c7bab7cbf5 Issue #27706: Fix regression in random.seed(somestr, version=1) 2016-08-31 15:01:08 -07:00
Raymond Hettinger
650c1c9ddd Minor beautification 2016-06-25 05:36:42 +03:00
Martin Panter
e26da7c03a Issue #27171: Fix typos in documentation, comments, and test function names 2016-06-02 10:07:09 +00:00
Raymond Hettinger
d58a0b6876 merge 2014-05-25 17:28:38 -07:00