Probability in random numbers!
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How to create a random 2D array that each cell has different probabilities to be either 0 or 1 for example? In other words, how to t create a 2D array with each cell having a probability of 0.1 to be 1's and 0.9 probability to be 0's.
0 commentaires
Réponses (2)
Walter Roberson
le 5 Août 2019
rand(m, n) <= 0.1
would be true (1) with probability 0.1
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!