diff options
Diffstat (limited to 'Lib/random.py')
-rw-r--r-- | Lib/random.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/random.py b/Lib/random.py index f1df18d..80fe447 100644 --- a/Lib/random.py +++ b/Lib/random.py @@ -192,6 +192,12 @@ class Random(_random.Random): ## ---- Methods below this point do not need to be overridden when ## ---- subclassing for the purpose of using a different core generator. +## -------------------- bytes methods --------------------- + + def randbytes(self, n): + """Generate n random bytes.""" + return self.getrandbits(n * 8).to_bytes(n, 'little') + ## -------------------- pickle support ------------------- # Issue 17489: Since __reduce__ was defined to fix #759889 this is no |