Commit Graph

242 Commits

Author SHA1 Message Date
Hugo van Kemenade ef6f0635ce gh-142389: Add backticks to stdlib argparse help to display in colour (#149384)
Co-authored-by: Savannah Ostrowski <savannah@python.org>
2026-05-04 22:23:18 +00:00
Raymond Hettinger da09ef807b gh-149221: Minor comment edit (gh-149278)
Minor comment edit
2026-05-02 08:29:06 -05:00
lighting9999 4f0cfe53cb gh-149221:Fix binomialvariate Function for random module (gh-149222) 2026-05-02 07:55:43 -05:00
Raymond Hettinger 798f791daf Minor edit: Move comments closer to the code they describe (gh-136477) 2025-07-09 10:23:46 -07:00
Hugo van Kemenade 4ac916ae33 gh-130645: Add color to stdlib argparse CLIs (gh-133380) 2025-05-05 19:46:46 +02:00
Sam Gross 844765b20f gh-131269: Minor optimization in random.py (#131270) 2025-03-20 17:10:33 -05:00
dgpb c83efa7a66 gh-131435: random.randint optimization (gh-131436) 2025-03-20 17:07:28 -05:00
Raymond Hettinger 25f24b01e3 Improve docstring for random.binomialvariate (gh-131164)
Add probability distribution to the docstring
2025-03-12 13:25:31 -05:00
Raymond Hettinger 286c517db0 gh-130285: Fix handling of zero or empty counts in random.sample() (gh-130291) 2025-02-21 11:33:10 -06:00
Anders Kaseorg a362c41bc9 gh-123968: Fix lower bound for python -m random --float (#123971) 2024-09-12 16:54:18 +03:00
Serhiy Storchaka 1a0c7b9ba4 gh-121905: Consistently use "floating-point" instead of "floating point" (GH-121907) 2024-07-19 08:06:02 +00:00
Hugo van Kemenade 3b32575ed6 gh-118131: Command-line interface for the random module (#118132) 2024-05-05 06:30:03 +00:00
Victor Stinner b9f814ce6f gh-111881: Import _sha2 lazily in random (#111889)
The random module now imports the _sha2 module lazily in the
Random.seed() method for str, bytes and bytearray seeds. It also
imports lazily the warnings module in the _randbelow() method for
classes without getrandbits(). Lazy import makes Python startup
faster and reduces the number of imported modules at startup.
2023-11-09 23:10:21 +01:00
Yilei Yang ce43d5f0e1 gh-110050: Adjust the newline position in the TypeError message of the random.seed call. (#110051)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2023-10-10 14:16:26 +02:00
Alex Waygood 21a6263020 gh-109653: Reduce the import time of random by 60% (#110221) 2023-10-02 22:56:31 +00:00
Raymond Hettinger 19bf398695 More informative docstrings in the random module (gh-109745) 2023-09-26 08:20:17 -05:00
Raymond Hettinger 75cd86599b Fix an ironic typo in a code comment. (gh-109186) 2023-09-09 10:21:42 -05:00
Raymond Hettinger 4695709143 Move binomialvariate() to a section for discrete distributions (GH-102955) 2023-03-23 12:10:12 -05:00
Andrew Hong 8bcd4a6ec7 GH-101097: Switch from standard interval notation to greater or less than signs for random.random()'s documentation (#101119) 2023-01-22 14:58:36 -06:00
Raymond Hettinger 9a68ff12c3 GH-100805: Support numpy.array() in random.choice(). (GH-100830) 2023-01-08 13:40:35 -06:00
Raymond Hettinger b430399d41 GH-100234: Set a default value for random.expovariate() (GH-100235) 2022-12-15 12:40:45 -06:00
Matthias Görgens 8a55e2f920 bpo-37000: Remove obsolete comment in _randbelow_with_getrandbits (#95775) 2022-08-08 18:22:26 -05:00
Raymond Hettinger eb9c8a8bea log2() is faster than log() (#95214) 2022-07-24 14:21:29 -05:00
Raymond Hettinger a2fbc51198 Compute v only when needed. (#95183) 2022-07-23 18:07:17 -05:00
Raymond Hettinger ed06ec1ab8 GH-81620: Add random.binomialvariate() (GH-94719) 2022-07-13 09:46:04 -05:00
Victor Stinner 47e35625ff gh-84623: Remove unused imports (#94132) 2022-06-22 19:14:27 +02:00
Raymond Hettinger 68fec31364 gh-86388 Remove deprecated behaviors in randrange() (#92677) 2022-05-11 23:54:51 -05:00
Zackery Spytz 08ec80113b bpo-46737: Add default arguments to random.gauss and normalvariate (GH-31360) 2022-02-15 17:12:15 -06:00
Miro Hrončok 6baa98e538 bpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" (GH-31098) 2022-02-03 07:48:13 -06:00
Raymond Hettinger 3fee7776e6 Move error test to the function that needs it. Improve error message. (GH-30008) 2021-12-09 20:24:50 -06:00
Raymond Hettinger 5afa0a4112 bpo-42222: Remove deprecated support for non-integer values (GH-28983) 2021-10-16 10:16:53 -05:00
Raymond Hettinger 9510e6f3c7 bpo-45155: Apply new byteorder default values for int.to/from_bytes (GH-28465) 2021-09-20 13:22:55 -05:00
Raymond Hettinger 70a071d9e1 bpo-40465: Remove random module features deprecated in 3.9 (GH-25874) 2021-05-04 10:55:40 +02:00
Raymond Hettinger b05352e4c2 bpo-44018: random.seed() no longer mutates its inputs (GH-25856) 2021-05-03 16:11:35 -07:00
Raymond Hettinger 2a36b09ce7 Improve the error message for choices(population, 10) (GH-25267) 2021-04-19 20:29:48 -07:00
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