How can one choose a number with a specific probability p
?
Say we must choose between {0, 1}
and the probability p
stands for choosing 1
.
So when p=0.8
we choose 1
with 80% and 0
with 20%.
Is there a simple solution in R for this?
See Question&Answers more detail:os