File tree 1 file changed +15
-10
lines changed
1 file changed +15
-10
lines changed Original file line number Diff line number Diff line change @@ -104,21 +104,16 @@ Bookkeeping functions
104
104
the time :func: `getstate ` was called.
105
105
106
106
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
+ -------------------
117
109
118
110
.. function :: randbytes(n)
119
111
120
112
Generate *n * random bytes.
121
113
114
+ This method should not be used for generating security tokens.
115
+ Use :func: `secrets.token_bytes ` instead.
116
+
122
117
.. versionadded :: 3.9
123
118
124
119
@@ -145,6 +140,16 @@ Functions for integers
145
140
Return a random integer *N * such that ``a <= N <= b ``. Alias for
146
141
``randrange(a, b+1) ``.
147
142
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
+
148
153
149
154
Functions for sequences
150
155
-----------------------
You can’t perform that action at this time.
0 commit comments