Matlab poisson random numbers
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I use in my code the Matlab function 'poissrnd' to produce random numbers, for example: A=poissrnd(100,1,20) to produce 20 random numbers!But some times the poissrnd function returns 2 or more same values e.g. 20,20. Is there any way the 'poissrnd' function to produce total different numbers each time I run it?
Thank you!
0 comentarios
Respuestas (2)
Walter Roberson
el 11 de Mzo. de 2011
That wouldn't be a poisson distribution anymore. The bulk of the probability is concentrated near the mean.
0 comentarios
Matt Tearle
el 11 de Mzo. de 2011
Any discrete distribution has a nonzero probability of producing repeats. If you don't want repeats then you're not sampling from a distribution, you're just permuting a set of values. For that, you can use randperm.
So the real question is what are you trying to achieve and why? I suppose you might want a random permutation, or portion thereof, that's weighted so that certain values are more likely to appear at the beginning of the sequence. In which case, you'll have to program that manually with a while loop. The ismember function could be useful.
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!