normrnd vs.random
Mostrar comentarios más antiguos
Dear, I would like to generate random nmbers with a normal distribution. From the documentation I see that there are two functioncs that seem to make the same things. normrnd(mu,sigma) and random('Normal',mu,sigma)
I wrote these two simpole for-loop in order to evaluate time consumption of these two functions and I found that normrnd is less time-consuming than random. I don't understand this difference. Could you help me?
tic for i=1:1000000 ciao=ciao+normrnd(0,0.01); end toc
tic for i=1:1000000 ciao=ciao+random('Normal',0,0.01); end toc
Kind regards
Andrea Giostri
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Climate Science and Analysis en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!