How can I simulate a binomial distribution without using a matlab command?

2 views (last 30 days)
Hello all,
Do some of you know how to simulate a Bin(n,p) distribution in matlab by only using the command binornd(1,p) (bernoulli distribution)? I am aware that I can do it with binornd(n,p) but I'm looking for another way.
Since the bernoulli is a special case of a binomial distribution I used the binornd command for simulating a bernoulli. Perhaps there is a better way for simulating a bernoulli distribution?
Can someone help me with this?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!