The first argument is a pointer to your random number generator state, and the second argument is the seed.
The first argument is a pointer to your random number generator state, and the second argument is the seed.
Right, but I guess I don't know how to make the result actually depend on s...
I'm sorry, I have been really confusing.
I've been messing with one of their sample programs, and it basically goes through like this.
T = gsl_rng_taus2;
r = gsl_rng_alloc (T);
printf ("%e\n", gsl_rng_uniform (r));
But changing s isn't as simple as just having
s=123;
gsl_rng_set (r,s)
because that doesn't do anything. The sample from the generator just depends on r, the seed should affect r since it affects the generator T...
And I don't really know...sorry I'm being so vague, but I just don't know how to get it to work.
I don't have GSL installed, unfortunately, so I can't try it out, but doesn't this:
print out the same five numbers, twice in a row? (If you'll pardon the C99 for loops.)Code:T = gsl_rng_taus2; r = gsl_rng_alloc(T); gsl_rng_set(r, 123L); for (int i=0; i < 5; i++) { printf("%e\n", gsl_rng_uniform(r)); } printf("\n"); gsl_rng_set(r, 123L); for (int i=0; i < 5; i++) { printf("%e\n", gsl_rng_uniform(r)); }
Yeah, it did. (Assuming you meant the same sequence of 5 different numbers, twice.)
Why do you have the L after 123?
Because that makes sense to me...I wasn't really doing much different.
Oh, all right.
Well, everything works now. Seriously, thanks a lot for your patience.