Difference between poissrnd and discrete random number (round(rand(1))).

7 views (last 30 days)
I am using Poissrnd(0.5) and round(rand(1)). Both functions gives discrete random numbers only. But if use poissrnd(0.5) program slow down compared to when I use round(rand(1)). It means program with round(rand(1)) is faster than program with poissrnd(0.5). So I want know any difference between these two functions(according functions wise).

Answers (1)

Roger Stafford
Roger Stafford on 21 Dec 2013
The two random generators give vastly different results, Murali. The call round(rand) can only give 0 and 1 values which are equally probable, whereas poissrnd(0.5) can give any non-negative integer as a result and these have the characteristic Poisson distribution where the probabilities are certainly not equal. See the Wikipedia site:
http://en.wikipedia.org/wiki/Poisson_distribution
  1 Comment
murali
murali on 23 Dec 2013
My sense is round(rand(1)*2) can give only 0,1,2 values similarly generate random value with poissrnd(0.5) but I will take only in between 0 and 2. Both computation speed same or not?? In my program if I use poissrnd(0.5) is slow compared to round(rand(1)*2). Just I want to Know is there any big difference according computation speed.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!