Commit graph

98 commits

Author SHA1 Message Date
Miss Islington (bot)
1536342c44
[3.9] Doc: Fix random.uniform example comment. (GH-25784) (GH-25843)
(cherry picked from commit 440c025726)


Co-authored-by: Julien Palard <julien@palard.fr>

Automerge-Triggered-By: GH:JulienPalard
2021-05-03 05:43:04 -07:00
Miss Islington (bot)
d458d8dab0
bpo-42559: Not that getrandbits() is non-negative. (GH-23843) (GH-23851) 2020-12-18 19:10:06 -08:00
Miss Skeleton (bot)
af891a962b
bpo-39108: Document threading issues for random.gauss() (GH-22928) (GH-22972) 2020-10-25 08:48:38 -07:00
Miss Skeleton (bot)
78723b378b
Minor clarification (GH-22708) (GH-22709) 2020-10-15 00:09:33 -07:00
Miss Skeleton (bot)
270a2fbc55
Improve recipe readability (GH-22685) (GH-22686) 2020-10-13 17:19:05 -07:00
Miss Skeleton (bot)
5f0007f0f8
Add recipe for a version of random() with a larger population (GH-22664) (GH-22684) 2020-10-13 12:38:13 -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
f01d1be97d
bpo-40286: Put methods in correct sections. Add security notice to use secrets for session tokens. (GH-19870) 2020-05-04 22:52:13 -07:00
Mathieu Dupuy
8aab84312e
Fix missing space in docs(GH-19866) 2020-05-02 16:50:47 -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
d3a8d616fa
Small improvements to the recipes and examples. (GH-19635)
* Add underscores to long numbers to improve readability
* Use bigger dataset in the bootstrapping example
* Convert single-server queue example to more useful multi-server queue
2020-04-21 16:11:00 -07: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
Julien Palard
58a4054760
Doc: Fix s/pseudo random/pseudo-random/ (GH-18289) 2020-01-31 10:50: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
Raymond Hettinger
d0cdeaab76
bpo-32554: Deprecate hashing arbitrary types in random.seed() (GH-15382) 2019-08-22 09:19:36 -07:00
Raymond Hettinger
8dbe563aa6
bpo-37624: Document weight assumptions for random.choices() (GH-14855) 2019-07-19 01:56:42 -07:00
Matthias Bussonnier
31e8d69bfe bpo-33783: Use proper class markup for random.Random docs (GHè7817)
Signed-off-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
2019-04-16 18:47:11 +02:00
Raymond Hettinger
47d9987247
bpo-35904: Add statistics.fmean() (GH-11892) 2019-02-21 15:06:29 -08:00
Raymond Hettinger
9abb725cea Improve readability of random module examples (GH-11884)
Based on reviewer feedback from Allen Downey, convert ``lambda`` to ``def``.
2019-02-15 12:40:18 -08:00
Raymond Hettinger
40ebe948e9
Document differences between random.choices() and random.choice(). (GH-11703) 2019-01-30 13:30:20 -08:00
Raymond Hettinger
71c62e14aa Neaten-up and extend the examples in the random module docs. 2016-12-04 11:00:34 -08:00
Serhiy Storchaka
0264e46caa Issue #28763: Use double hyphens (rendered as en-dashes) in numerical ranges
in the documentation.
2016-11-26 13:49:59 +02:00
Serhiy Storchaka
c7b1a0bbe2 Issue #28763: Use double hyphens (rendered as en-dashes) in numerical ranges
in the documentation.
2016-11-26 13:43:28 +02:00
Raymond Hettinger
7f94619555 Fix grammar 2016-11-21 15:13:18 -08:00
Raymond Hettinger
1149d9326e Add analysis section to motivate the single server queue example 2016-11-21 14:13:07 -08:00
Raymond Hettinger
e1329105b3 Misc readability and organization improvements for the random docs 2016-11-21 12:33:50 -08:00
Raymond Hettinger
0537405ec1 Add a seealso section for further reference and skill building 2016-11-21 10:52:04 -08:00
Raymond Hettinger
8ab1258b58 Simplify code in an example 2016-11-21 10:16:01 -08:00
Raymond Hettinger
6befb64172 Extend and improve the examples for the random module 2016-11-21 01:59:39 -08:00
Raymond Hettinger
a3950e42b0 Small edits to the docs for sample() and shuffle(). 2016-11-17 01:49:54 -08:00
Raymond Hettinger
0a1a909fe2 Further refinements to the examples and recipes for the random module 2016-11-17 00:45:35 -08:00
Raymond Hettinger
00305ade58 Add another example to the recipes section of the random docs 2016-11-16 22:56:11 -08:00
Raymond Hettinger
2589ee3e2b Minor touch-ups to the random module examples 2016-11-16 21:34:17 -08:00
Raymond Hettinger
16ef5d4ae1 Add cum_weights example (simulation of a cumulative binomial distribution). 2016-10-31 22:53:52 -07:00
Raymond Hettinger
1c3a121bb0 Issue #18844: Fix-up examples for random.choices(). Remove over-specified test. 2016-10-12 01:42:10 -04: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
f5b7c7bfc1 Improve recipe by showing results of intermediate steps 2016-09-05 13:15:02 -07:00
Raymond Hettinger
16eb827b33 Improve docs for random.seed() 2016-09-04 11:17:28 -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
Raymond Hettinger
c7fac12f19 Merge 2016-09-05 13:15:20 -07:00
Raymond Hettinger
6579502c7e Merge 2016-09-04 11:17:48 -07:00
Steven D'Aprano
b2871faa87 Documentation for secrets.py 2016-04-17 01:42:33 +10:00
Georg Brandl
5d94134040 Closes #25910: fix dead and permanently redirected links in the docs. Thanks to SilentGhost for the patch. 2016-02-26 19:37:12 +01:00
Georg Brandl
92849d1721 Closes #20169: fix inner links random doc. 2016-02-19 08:57:38 +01:00
Raymond Hettinger
c89a451ae1 By popular demand, add back a security warning. 2014-05-11 02:26:23 -07:00
Raymond Hettinger
a7894f7f4c Remove the redundant and poorly worded warning message.
The paragraph above already says, clearly and correctly, that
"However, being completely deterministic, it is not suitable for
all purposes, and is completely unsuitable for cryptographic purposes."

Also we should make any promises about SystemRandom or os.urandom()
being cryptographically secure (they may be, but be can't validate
that promise).  Further, those are actual random number generators
not psuedo-random number generators.
2014-05-10 14:05:28 -07:00
Antoine Pitrou
ba69008bd0 Issue #16190: fix random module recommendation to use ssl.RAND_bytes(). 2013-08-16 19:19:40 +02:00