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 rhettinger
Recipients mark.dickinson, rhettinger, tim.peters
Date 2019-06-28.09:28:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1561714089.16.0.904652961331.issue37439@roundup.psfhosted.org>
In-reply-to
Content
This a small snippet of code I written dozens of times.  It would be nice to have this in the library along with the other distributions.

def binomialvariate(n, p):
    ''' Binomial distribution for the number of successes
        in *n* Bernoulli trials each with a probability *p*
        of success.

        Returns an integer in the range:  0 <= X <= n
    '''
    return sum(random() < p for i in range(n))
History
Date User Action Args
2019-06-28 09:28:09rhettingersetrecipients: + rhettinger, tim.peters, mark.dickinson
2019-06-28 09:28:09rhettingersetmessageid: <1561714089.16.0.904652961331.issue37439@roundup.psfhosted.org>
2019-06-28 09:28:09rhettingerlinkissue37439 messages
2019-06-28 09:28:09rhettingercreate