In [1]:
import numpy as np

In [9]:
bernoulli_trials = np.random.randint(2, size=1000)
np.mean(bernoulli_trials)


Out[9]:
0.49399999999999999