help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] generating random numbers between two numbers


From: Ralph Silva
Subject: Re: [Help-gsl] generating random numbers between two numbers
Date: Wed, 7 May 2008 09:36:41 +1000

On Tue, May 6, 2008 at 10:00 PM, Awhan Patnaik <address@hidden> wrote:

> GSL allows random number generation between the unit interval [0,1].
> However
> if one has to generate numbers between ANY two real numbers a and b then
> one
> way is the following:
> num = a + rand*(b-a) where rand is a random number in the unit interval.
> Is
> this the only way available ? I mean are the statistical properties
> preserved in such cases.
>

It is totally preserved.
If X ~ Uniform(0,1), then Y = a + (b-a)X ~ Uniform(a,b)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]