Thank you, Wayne!
"Wayne King" <wmkingty@gmail.com> wrote in message <ioj3lc$mju$1@fred.mathworks.com>...
> "Liana" wrote in message <ioipb8$d7i$1@fred.mathworks.com>...
> > I guess I found the answer:
> >
> > rand('state', 0); % use before 'unifrnd'
> > unifrnd...
> >
> > "Liana" wrote in message <ioiomk$3kh$1@fred.mathworks.com>...
> > > I found out that it's possible to define seed numbers for 'randn' (normal distribution)  http://www.mathworks.com/help/techdoc/math/bsn94u01.html
> > > Is there the same thing for 'unifrnd'?
> > > Thx.
> > >
> > > "Liana" wrote in message <ioildl$bbs$1@fred.mathworks.com>...
> > > > Hello,
> > > >
> > > > I'm using 'unifrnd' to generate uniformly distributed random numbers. The question is if I can define a seed number for 'unifrnd' in order to generate the same random numbers sequence.
> > > >
> > > > Thanks.
>
> Hi Liana, Yes, you are correct. Just seed the random number generator before calling unifrnd.
> In R2011a, there is a new function rng, that makes controlling the random number generator simplier.
>
> rng(1e3)
> x = unifrnd(1,1,10,1)
>
> rng(1e3)
> y = unifrnd(1,1,10,1)
>
> x and y are the same random sequence.
>
> Wayne
