vendredi 8 mai 2015

Bernoulli random variables in c++

What is the easiest way to get a Bernoulli distributed random variable in C++? I I have a non-const p. p starts from 0, getting p+=0.01 , until p=1. ("for" loop) I have this idea:

declare int aray in size of 100, intilized with zeros. evrey time the p gets +0.01, I change one zero to "1"... and get a random number%100.

is it good? thanks




Aucun commentaire:

Enregistrer un commentaire