In general, this is the only way available. If you have a probability distribution for a variable x, (i.e. p(X)dX is the probably that x lies in [X, X + dX]), then the probability distribution for a function of that variable, y(x), is given by p(Y) = p(X) / dy/dx. If you want p(Y) = const, and you know that p(X) = const, then you must have dy/dx = const => y = c + d x for some c and d. That is, only linear functions take a uniform distribution to a uniform distribution. So, the only way to generate a uniform distribution on [a,b] given a uniform distribution on [0,1] is the way you outlined.

Will

On May 6, 2008, at 8:00 AM, Awhan Patnaik 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.
_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl



_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to