2014-12-17 18:10:23 +03:00
|
|
|
#include "gsl/gsl_rng.h"
|
2016-04-29 17:53:13 +03:00
|
|
|
#include <math.h>
|
2014-12-17 18:10:23 +03:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
// return code
|
|
|
|
int retval = 1;
|
|
|
|
|
|
|
|
// create a generator
|
2016-05-16 17:34:04 +03:00
|
|
|
gsl_rng* generator;
|
2014-12-17 18:10:23 +03:00
|
|
|
generator = gsl_rng_alloc(gsl_rng_mt19937);
|
|
|
|
|
|
|
|
// Read a value.
|
|
|
|
double const Result = gsl_rng_uniform(generator);
|
|
|
|
|
|
|
|
// Check value
|
2016-05-16 17:34:04 +03:00
|
|
|
double const expectedResult(0.999741748906672);
|
|
|
|
if (fabs(expectedResult - Result) < 1.0e-6)
|
2014-12-17 18:10:23 +03:00
|
|
|
retval = 0;
|
|
|
|
|
|
|
|
// free allocated memory
|
|
|
|
gsl_rng_free(generator);
|
|
|
|
return retval;
|
|
|
|
}
|