New submission from Dong-hee Na <donghee...@python.org>:
I noticed that the random library does not provide `random.randbool()`. Generating bool value is quite common in the use-case when we generated faked data (unittest, machine learning training, etc) Somebody can say write your own library but it's too common use-case and in physically some isolated environments is hard to use 3rd party library. Since the bool value is the built-in type of python, I think that is very useful when we provide this function. I would like to get opinions from Raymond and then proceed with this issue. Here is the candidate implementation: def randbool(): return bool(getrandbits(1)) ---------- components: Library (Lib) messages: 395671 nosy: corona10, rhettinger priority: normal severity: normal status: open title: Propose random.randbool() type: enhancement versions: Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44400> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com