DSPRelated.com
Forums

Seeds in random numbre generators...

Started by Pramodh Narayanan September 6, 2002
Hi!

I just need to generate random numbers that follow
some distribution like poisson,
exponential,normal,etc. For these distributions there
are functions available directly like poissrnd for
poisson distribution, normrnd for normal
distribution,etc. But every time u run them they give
different sets of random numbers. How do I know what
is the seed used to generate these numbers so that I
can reuse the seed to generate them , if I want to.

Thankx,
Pramodh.



The functions poissrnd, normrnd... internally use rand
or randn. You can check which one is used by looking
into the function in an editor.
You can set the seeds of rand or randn thereby making
these wrapper functions repeatable.

Navan
--- Pramodh Narayanan <> wrote:
> Hi!
>
> I just need to generate random numbers that follow
> some distribution like poisson,
> exponential,normal,etc. For these distributions
> there
> are functions available directly like poissrnd for
> poisson distribution, normrnd for normal
> distribution,etc. But every time u run them they
> give
> different sets of random numbers. How do I know what
> is the seed used to generate these numbers so that I
> can reuse the seed to generate them , if I want to.
>
> Thankx,
> Pramodh.


__________________________________________________


Hi,
Use the 'state' switch. See the help:
>> help rand

Joe
BSTEX - Equation viewer for Matlab
http://www.geocities.com/bstex2001

--- Pramodh Narayanan <> wrote:
> Hi!
>
> I just need to generate random numbers that follow
> some distribution like poisson,
> exponential,normal,etc. For these distributions
> there
> are functions available directly like poissrnd for
> poisson distribution, normrnd for normal
> distribution,etc. But every time u run them they
> give
> different sets of random numbers. How do I know what
> is the seed used to generate these numbers so that I
> can reuse the seed to generate them , if I want to.
>
> Thankx,
> Pramodh. >


__________________________________________________