Thread: gsl seeding random number generator

1. The first argument is a pointer to your random number generator state, and the second argument is the seed.

2. Right, but I guess I don't know how to make the result actually depend on s...

Right, but I guess I don't know how to make the result actually depend on s...
That's not your job, that's the job of the people who made the random number generator. All your job is, is to feed s into the function.

In other words: I have no idea what you think you're asking here.

4. 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.

5. I don't have GSL installed, unfortunately, so I can't try it out, but doesn't this:
Code:
```T = gsl_rng_taus2;
r = gsl_rng_alloc(T);
gsl_rng_set(r, 123L);
for (int i=0; i < 5; i++) {
printf("&#37;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));
}```
print out the same five numbers, twice in a row? (If you'll pardon the C99 for loops.)

6. 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.

7. "L" means long.

8. Oh, all right.
Well, everything works now. Seriously, thanks a lot for your patience.