generate 0 and 1
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dawon Yoo
le 28 Mar 2020
Réponse apportée : John D'Errico
le 28 Mar 2020
how do I generate a binary sequence with certain probabilities?
for instance, I want 0 to have 0.6 and 1 to have 0.4 probability
It would be very helpful if you give me the whole code to this
0 commentaires
Réponse acceptée
John D'Errico
le 28 Mar 2020
rand() < 0.6
If you want a random binary sequence of length n, then this is sufficient:
rand(1,n) < 0.6
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Random Number Generation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!