i need to implement 100 repetitions of drawing 5 Bernoulli random variable (5 cards)with bias 0.2 in python and plot the distribution.
so far my implementation is
for i in range(5):
b= bernoulli.rvs(p=0.2,size=100)
how ever Bernoulli.rvs generates 100 repetitions with 0.2 bias.this is suitable for drawing a single card. how do i implement for drawing 5 cards.?i added a for loop in my implementation. but im not sure if its right.
solved i solved it by using np.random.binomial rather than using bernoulli.rvs. it solved my problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.