File tree Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Expand file tree Collapse file tree 1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -104,21 +104,16 @@ Bookkeeping functions
104104 the time :func: `getstate ` was called.
105105
106106
107- .. function :: getrandbits(k)
108-
109- Returns a Python integer with *k * random bits. This method is supplied with
110- the Mersenne Twister generator and some other generators may also provide it
111- as an optional part of the API. When available, :meth: `getrandbits ` enables
112- :meth: `randrange ` to handle arbitrarily large ranges.
113-
114- .. versionchanged :: 3.9
115- This method now accepts zero for *k *.
116-
107+ Functions for bytes
108+ -------------------
117109
118110.. function :: randbytes(n)
119111
120112 Generate *n * random bytes.
121113
114+ This method should not be used for generating security tokens.
115+ Use :func: `secrets.token_bytes ` instead.
116+
122117 .. versionadded :: 3.9
123118
124119
@@ -145,6 +140,16 @@ Functions for integers
145140 Return a random integer *N * such that ``a <= N <= b ``. Alias for
146141 ``randrange(a, b+1) ``.
147142
143+ .. function :: getrandbits(k)
144+
145+ Returns a Python integer with *k * random bits. This method is supplied with
146+ the MersenneTwister generator and some other generators may also provide it
147+ as an optional part of the API. When available, :meth: `getrandbits ` enables
148+ :meth: `randrange ` to handle arbitrarily large ranges.
149+
150+ .. versionchanged :: 3.9
151+ This method now accepts zero for *k *.
152+
148153
149154Functions for sequences
150155-----------------------
You can’t perform that action at this time.
0 commit comments