# Draw random samples from a mixture of two equally likely binomials,
# one with p(success) = 0.1, the other with p(success) = 0.9
x <- rbinommix(200, c(0.5, 0.5), c(0.1, 0.9), 16)
hist(x, probability=TRUE)
lines(density(x), col='red')
Run the code above in your browser using DataLab