[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [Help-gsl] Re: Random number generation
From: |
Abbas Alhakim |
Subject: |
RE: [Help-gsl] Re: Random number generation |
Date: |
Wed, 6 May 2009 21:55:31 -0400 |
You are then trying to get variables from a restricted normal
distribution, say from the interval (a,b). One quick way is to keep
generating numbers you get something in (a,b) and toss the rest.
Abbas
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of
Vibhuti Dave
Sent: Wednesday, May 06, 2009 6:43 PM
To: address@hidden
Subject: Re: [Help-gsl] Re: Random number generation
Everyone
Thank you for helping me out. I appreciate it.
Is there a way I can specify the range in which numbers are generated so
that the numbers are not generated between -inf to +inf
On 5/5/09 8:43 PM, "Carl Boettiger" <address@hidden> wrote:
> The number shouldn't be close to zero. Divide by 600 and you'll have
> the mean, which will be close to zero. Just sum a bunch of gaussian
> random numbers of standard deviation sigma and you expect a
> displacement of sqrt(2 sigma T), i.e. sqrt(1200) approx 34 -- you're
> simulating Brownian motion.
>
> -Carl
>
> On Tue, May 5, 2009 at 2:10 PM, Rodney Sparapani <address@hidden>
wrote:
>> Vibhuti Dave wrote:
>>>
>>> Hello,
>>>
>>> I have attached the code that I am using to generate random numbers
that
>>> have a Gaussian distribution with a mean value of 0.
>>> Ideally, if I generate these numbers and sum them up, the sum should
be
>>> very
>>> close to 0 since it is a gaussian ditribution. I am using the
function
>>> gsl_ran_gaussian to generate them. However, the mean value seems to
be way
>>> off 0 when I run the program.
>>> Any idea why that might be happening?
>>> Thanks
>>> Vibhuti
>>
>> What happens if you set mu = 0.?
>>
>>
>>
>> _______________________________________________
>> Help-gsl mailing list
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/help-gsl
>>
>
>
-------------------------------------
Vibhuti Dave
Enjoy Life to the Maximum
-------------------------------------
_______________________________________________
Help-gsl mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-gsl