swh:1:snp:3cba5856b0ddc3feab6c3c2d096d614b02c883ec
Raw File
Tip revision: 83e207a54e158972e4beeb36439daa5e80744d24 authored by Brad King on 10 November 2017, 12:37:49 UTC
CMake 3.9.6
Tip revision: 83e207a
main.cc
#include "gsl/gsl_rng.h"
#include <math.h>

int main()
{
  // return code
  int retval = 1;

  // create a generator
  gsl_rng* generator;
  generator = gsl_rng_alloc(gsl_rng_mt19937);

  // Read a value.
  double const Result = gsl_rng_uniform(generator);

  // Check value
  double const expectedResult(0.999741748906672);
  if (fabs(expectedResult - Result) < 1.0e-6)
    retval = 0;

  // free allocated memory
  gsl_rng_free(generator);
  return retval;
}
back to top