#ifndef ERND_H
#define ERND_H

#include "eutils.h"

#ifdef EUTILS_HAVE_LIBGSL
 #include <gsl/gsl_rng.h>
 #include <gsl/gsl_randist.h>
#else
 #include <stdlib.h>
#endif

#include "ematrix.h"

class ernd
{
 public:
  ernd();
  ~ernd();

  unsigned long seed;

  void setSeed(unsigned long seed);
//  int getSeed();

  double uniform();
#ifdef EUTILS_HAVE_LIBGSL
  gsl_rng *grng;
  double gamma(double k,double t);
  double gaussian(double sigma);
  double exponential(double rate);
  unsigned int geometric(double mean);
  void dirichlet(const evector& alpha, evector& ret);
#elif defined(__APPLE__)
  unsigned int rstate;
//#elif !defined(_WIN32)
#elif defined(_MSC_VER)
  BCRYPT_ALG_HANDLE hCryptAlg;
#else
  char statebuf[16];
  struct random_data rdata;
#endif
};

extern ernd rnd;

#endif

