MATH 314 Quiz 05

Given on 2026-09-02

  1. Write a Python class named BernoulliDistribution that has the following API/functionality.

    B1 = BernoulliDistribution()
    # generate 10 Bernoulli(p = 0.5) random variables
    # with a default seed value (you choose)
    B1.rvs(size = 10)
    
    p = 0.25
    seed = 155
    B2 = BernoulliDistribution(seed = seed, p = 0.77)
    # generate 22 Bernoulli(p = 0.77) random variables
    # with seed = 155
    B2.rvs(size = 22)