How to generate random number from Bernoulli distribution?
70 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
PARVATHY NAIR
il 19 Gen 2023
Risposto: Bruno Luong
il 19 Gen 2023
just like the below command
a=randn(1,1000)
how can we generate random number from bernoulli distribution
0 Commenti
Risposta accettata
Bruno Luong
il 19 Gen 2023
p = 0.25
X = double(rand(1,1000) < p)
histogram(X,'Normalization','pdf')
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Random Number Generation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!