Re: Random number generator
- From: ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx (Roger Stafford)
- Date: Thu, 29 Sep 2005 20:24:24 GMT
In article <m3zmpvit9s.fsf@xxxxxxxxxxxxxxxxxxxxxx>, Peter Boettcher
<boettcher@xxxxxxxxxx> wrote:
> "Anindo Roy" <anindoroy1975@xxxxxxxxx> writes:
>
> > Hi all,
> >
> > I wanted to find out if any of the pseudo-random number generator
> > functions in MATLAB (e.g. rand, randn, etc) can be modified to solve
> > the following problem:
> >
> > Generate a sequence of (pseudo) random numbers each of which is
> > bounded between "a" and "b" where "a", "b" are known and fixed
> > scalars.
> >
> > I don't care about the distribution of the random numbers as long as
> > each element belongs to the interval (a,b).
>
> How about the distribution x_n=a? They're all in the interval
> a<=x_n<=b. Surely you must have SOME requirements for the
> distribution...
>
> Knowing that rand outputs numbers between 0 and 1, think about
> possible transformations to apply to those numbers that would give you
> what you want...
> --
> Peter Boettcher <boettcher@xxxxxxxxxx>
-------------------------------------------------
Hello Anindo,
Peter is right. You really do need to have some idea of the
distribution within [a,b]. If you want them uniformly distributed, just
do this
x = (b-a)*rand(1,n) + a
There are a great many other possibilities.
(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
.
- References:
- Random number generator
- From: Anindo Roy
- Re: Random number generator
- From: Peter Boettcher
- Random number generator
- Prev by Date: Re: need matlab code and algorithms for image restoration
- Next by Date: Re: system of nonlinear equations
- Previous by thread: Re: Random number generator
- Next by thread: Reading Quicktime videos using Matlab
- Index(es):
Relevant Pages
|