title: gsl_rng functions: in what order do they compile
body: <p>I am learning gsl_rng library and found an interesting question.</p>
  
  <p>I understand that the environment variables (<code>GSL_RNG_TYPE</code> and <code>GSL_RNG_SEED</code>) can be used to set library variables (<code>gsl_rng_default</code> and <code>gsl_rng_default_seed</code>) during run time (without re-compile). You just need to add <code>gsl_rng_env_setup()</code> and then change these two variables in terminal before do <code>./a.out</code>.</p>
  
  <p>However, if I specifically set the <code>gsl_rng_default</code> and <code>gsl_rng_default</code>_seed in the code (eg. use "taus" and "12"), with the same program compiled, now I cannot change the seed value at run time but can still change the generator type.</p>
  
  <p>I am new to this stuff so probably I missed something. But can anyone help me understand why this happen? Why do these two variables behave differently? Is there an order or over-write problem?</p>
  
  <p>Here is my code (simple practice):</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;gsl/gsl_rng.h&gt;
  
  int main (void)
  {
    const gsl_rng_type * T;   /*generator type*/
    gsl_rng * r;          /*rng instance*/
  
    int i, n = 20;
  
    gsl_rng_env_setup();      /*read from environment variable*/
  
  
    T = gsl_rng_default;  /*choose default generator type*/
  
    gsl_rng_default = gsl_rng_mt19937;
    gsl_rng_default_seed = 12;
  
    r = gsl_rng_alloc (T);    /*create an instance*/
  
    for (i = 0; i &lt; n; i++) 
      {
        double u = gsl_rng_uniform (r);
        printf ("%.5f\n", u);
      }
  
  
  
    gsl_rng_free (r);     /*free all memory associated with r*/
  
   return 0;
  }
  </code></pre>