Beispiel #1
0
    def rvs(self, num_draws):
        
        draws = []

        for i in range(self.n):
            bern_draws = sum(bernoulli(self.p).rvs(self.n))
            draws.append(bern_draws)

        return draws
Beispiel #2
0
    def rvs(self, num_draws):

        draws = []

        for i in range(self.n):
            bern_draws = sum(bernoulli(self.p).rvs(self.n))
            draws.append(bern_draws)

        return draws
Beispiel #3
0
from stats.bernoulli import bernoulli
from stats.binomial import binomial
from time import time

start = time()

bern_draws = bernoulli(0.5).rvs(1000000)
mean = sum(bern_draws) / len(bern_draws)

binom_draws = binomial(100, 0.5).rvs(100)
print(binom_draws)

end = time()

print(end - start)