Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
$ ./python -m timeit -s 'import random' 'random.randbytes(10**6)' 200 loops, best of 5: 1.36 msec per loop $ ./python -m timeit -s 'import random' 'random.getrandbits(10**6*8).to_bytes(10**6, "little")' 50 loops, best of 5: 6.31 msec per loop The Python implementation is only 5 times slower than the C implementation. I am fine with implementing randbytes() in Python. This would automatically make it depending on the getrandbits() implementation. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40286> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com