This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients corona10, mark.dickinson, rhettinger, serhiy.storchaka, steven.daprano
Date 2021-06-12.13:45:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623505502.88.0.150413598834.issue44400@roundup.psfhosted.org>
In-reply-to
Content
As for randbool() I concur with Steven. It is too trivial and in most case you do not even need to call bool().

Alternate methods:

    choice((False, True))
    random() < 0.5

They are less efficient than getrandbits(1), but can be easily extended to non-binary output or non-uniform distribution.
History
Date User Action Args
2021-06-12 13:45:02serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, mark.dickinson, steven.daprano, corona10
2021-06-12 13:45:02serhiy.storchakasetmessageid: <1623505502.88.0.150413598834.issue44400@roundup.psfhosted.org>
2021-06-12 13:45:02serhiy.storchakalinkissue44400 messages
2021-06-12 13:45:02serhiy.storchakacreate