The expected value can be changed directly by dragging left or right on the chart. This can also be done using the box below the chart which shows the mean ± one standard deviation. As the expected value gets closer to 0 or 1, the variance also approaches zero.
The illustration above shows an experiment with only two possible outcomes:
- ❌
- X = 0 indicates "failure" which occurs with probability 1 - p.
- ✅
- X = 1 indicates "success" which occurs with probability p.
The simulation above shows a number U chose randomly from the interval [0, 1]. The light blue line shows the Bernoulli(p) random variable X which equals 1 if U falls in the green interval of length p, and 0 if U falls in the grey interval of length 1 - p. The histogram accumulates the results of each simulation.