help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Random number generation


From: dantian
Subject: Re: [Help-gsl] Random number generation
Date: Tue, 05 May 2009 15:26:20 -0400
User-agent: Thunderbird 2.0.0.18 (X11/20081105)

Hi,

here is how I initialized my random number generator (I use taus but you can adapt it for your case).

- First in the code:

*  const gsl_rng_type *Type_rdm ;
  gsl_rng *alloc_rdm ;
  gsl_rng_env_setup() ;
  Type_rdm = gsl_rng_default ;
  alloc_rdm = gsl_rng_alloc (Type_rdm) ;*

/(It's actually from gsl website)/

- Then before execute the program I do:

  *setenv GSL_RNG_TYPE taus
  setenv GSL_RNG_SEED `date +%s`*

/(Also from gsl website)/

It do work pretty well.

Hope it helps,
Best,

          Eric.

Vibhuti Dave wrote:
Hi,
I am trying to generate a random sequence of numbers that have a Gaussian
distribution with mean 0 and standard deviation of 1.
My code is attached. It is a simple code since I am beginner at programming
and also using the GSL library for the first time. I need to run this code a
1000 times. Each time, i want the code to generate 600 random numbers with a
Gaussian distribution as specified above. My question is, is there a way to
change the seed for the random function generator besides changing it at
command line. I cant run the code manually a 1000 times to make sure that i
get to change the seed.
Any help would be appreciated, thanks
Vibhuti
------------------------------------------------------------------------

_______________________________________________
Help-gsl mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/help-gsl

--
/ Be the change you wish to see in the world
/ --- Mahatma Gandhi ---

dantian.free.fr <http://dantian.free.fr>

/gtalk/: address@hidden
/msn/: address@hidden
/skype/: aihaike

/ Please consider the environment before printing this email.
Considérez svp l'environnement avant d'imprimer cet email. /



reply via email to

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