206 namespace librandom {
266 unsigned long ulrand(
const unsigned long);
268 void seed(
const unsigned long);
294 virtual void seed_(
unsigned long) =0;
295 virtual double drand_() =0;
302 std::vector<double>::const_iterator
next_;
303 std::vector<double>::const_iterator
end_;
334 template <
typename Generator>
362 }
while ( r == 0.0 );
371 return static_cast<unsigned long>(std::floor(n *
drand()));
382 #endif // RANDOMGEN_H
size_t get_buffsize(void) const
returns buffer size
Definition: randomgen.h:375
void refill_()
refill buffer
Definition: randomgen.cpp:67
virtual double drand_()=0
drawing interface
static const size_t DEFAULT_BUFFSIZE
Definition: randomgen.h:241
double drandpos(void)
draw from (0, 1)
Definition: randomgen.h:356
void set_buffsize(const size_t)
set buffer size
Definition: randomgen.cpp:43
void seed(const unsigned long)
set random seed to a new value
Definition: randomgen.cpp:58
RngPtr create(unsigned long s) const
Create generator with given seed.
Definition: randomgen.h:337
double drand(void)
The following functions implement the user interface of the RandomGen class, including buffer managem...
Definition: randomgen.h:341
double operator()(void)
draw from [0, 1)
Definition: randomgen.h:350
static const unsigned long DefaultSeed
Default value for seeding generators in places where no seed is supplied.
Definition: randomgen.h:282
lockPTR< RandomGen > RngPtr
Common lock-pointer type for RNG.
Definition: randomgen.h:208
unsigned long ulrand(const unsigned long)
draw from [0, n-1]
Definition: randomgen.h:368
Factory class for random generators.
Definition: randomgen.h:314
virtual RngPtr clone(const unsigned long)=0
clone a random number generator of same type initialized with given seed
Concrete template for factories for built-in (non GSL) random generators.
Definition: randomgen.h:335
std::vector< double >::const_iterator end_
== buffer_.end()
Definition: randomgen.h:303
RandomGen()
Definition: randomgen.cpp:29
Abstract base class for all random generator objects.
Definition: randomgen.h:238
virtual ~GenericRNGFactory()
Definition: randomgen.h:326
std::vector< double > buffer_
random number buffer
Definition: randomgen.h:301
const Name n("n")
Number of synaptic release sites (int >=0) (Tsodyks2_connection)
Definition: nest_names.h:202
virtual void seed_(unsigned long)=0
The following functions provide the interface to the actual random generator.
std::vector< double >::const_iterator next_
next number to return
Definition: randomgen.h:302
virtual ~RandomGen()
Definition: randomgen.h:255
virtual RngPtr create(unsigned long) const =0
Create generator with given seed.
static RngPtr create_knuthlfg_rng(unsigned long)
Create built-in Knuth Lagged Fibonacci random generator.
Definition: randomgen.cpp:77