Go to the first, previous, next, last section, table of contents.

Examples

The following program prints the first 1024 points of the 2-dimensional Sobol sequence.

#include <stdio.h>
#include <gsl/gsl_qrng.h>

int
main (void)
{
  int i;
  gsl_qrng * q = gsl_qrng_alloc (gsl_qrng_sobol, 2);

  for (i = 0; i < 1024; i++)
    {
      double v[2];
      gsl_qrng_get(q, v);
      printf("%.5f %.5f\n", v[0], v[1]);
    }

  gsl_qrng_free(q);
  return 0;
}

Here is the output from the program,

$ ./a.out
0.50000 0.50000
0.75000 0.25000
0.25000 0.75000
0.37500 0.37500
0.87500 0.87500
0.62500 0.12500
0.12500 0.62500
....

It can be seen that successive points progressively fill-in the spaces between previous points. The following plot shows the distribution in the x-y plane of the first 1024 points from the Sobol sequence,

@image{qrng}

Distribution of the first 1024 points from the quasi-random Sobol sequence


Go to the first, previous, next, last section, table of contents.