[New-bugs-announce] [issue44400] Propose random.randbool()
Dong-hee Na
report at bugs.python.org
Fri Jun 11 20:33:48 EDT 2021
New submission from Dong-hee Na <donghee.na at 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 <report at bugs.python.org>
<https://bugs.python.org/issue44400>
_______________________________________
More information about the New-bugs-announce
mailing list