I am trying to generate random integers (either 0 or 1). This code does this very well:
randi([0 1],10000,1)
The only problem is that randi
obviously generates binomial distributions. I need to be able to set a weighting to these numbers. For example, I want 55% of the distribution to be 1 and the other 45% to be 0.
Is there a way to do this?
Aucun commentaire:
Enregistrer un commentaire