help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] accessing random number generator from functions


From: Joakim Hove
Subject: Re: [Help-gsl] accessing random number generator from functions
Date: Tue, 23 Nov 2004 09:09:46 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.2 (gnu/linux)

Nathan Moore <address@hidden> writes:

> This is a general question about the scope of random number
> generators. 

A (gsl) random number generator is implemented as a struct, and %100
normal scoping rules apply.

Your code should be modified to pass a pointer to an rng instance to the
calculate_average function:


   double calculate_average(gsl_rng *rng , long num_terms) { 

   }  
 
   ....
   ....

   ave_x = calculate_average(dice , num_terms);



HTH - Joakim


-- 
Joakim Hove
hove AT ift uib no
Tlf: +47 (55 5)8 27 90 
Fax: +47 (55 5)8 94 40
http://www.ift.uib.no/~hove/





reply via email to

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