source: trunk/lib/random/Random.cc @ 366

Last change on this file since 366 was 366, checked in by Peter, 17 years ago

moved namespace random to its own directory

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 466 bytes
Line 
1// $Id: Random.cc 366 2005-08-05 08:58:56Z peter $
2
3#include <c++_tools/random/Random.h>
4
5namespace theplu {
6namespace random {
7
8
9  RNG* RNG::instance_ = NULL;
10
11
12  RNG::RNG(void)
13  {
14    gsl_rng_env_setup();
15    rng_ = gsl_rng_alloc(gsl_rng_default);  // Memory is allocated here!
16  }
17
18
19
20  RNG::~RNG(void)
21  {
22    gsl_rng_free(rng_);
23    rng_=NULL;
24    delete instance_;
25  }
26
27
28
29  RNG* RNG::instance(int seed)
30  {
31    if (!instance_)
32      instance_ = new RNG();
33    return instance_;
34  }
35
36
37}} // of namespace random and namespace theplu
Note: See TracBrowser for help on using the repository browser.