[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] random number generator
From: |
Tom Vajzovic |
Subject: |
Re: [Help-gsl] random number generator |
Date: |
Thu, 11 May 2006 18:14:18 +0100 |
User-agent: |
KMail/1.7.2 |
Hi Amy,
On Thursday 11 May 2006 10:37, u4r07 wrote:
> hi, attached is my program, i'm trying to get a file with lots of random
> numbers in however when i try and change the seed there is a problem
> i keep getting a compiling error message for the gsl function:
>
> gsl_rng_set(const gsl_rng * r, s);
you should just write:
gsl_rng_set( r, s );
When you see a line like:
int function_name( some_type var_name, other_type * var_name2 );
This is a prototype, which tells the compiler the types of arguments your
function takes and what type it returns.
When you call the function (run it), you should already have a variable of the
correct type, and so you just write it's name.
On a separate note, be aware that you line:
for (s=1; s < 500; s++){...}
will repeat whatever's in the braces 499 times. To do it 500 times, you need:
for (s=0; s < 500; s++){...}
or if you are confused by counting from zero (who wouldn't be?) then you can
use:
for (s=1; s <= 500; s++){...}
These two changes won't make your program work on their own, but I'd hate to
do all of your assignment for you ;-)
Tom