NEURON
MCellRan4RNG.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <cstdint>
4 
5 #include "RNG.h"
6 #include "mcran4.h"
7 
8 // The decision that has to be made is whether each generator instance
9 // should have its own seed or only one seed for all. We choose separate
10 // seed for each but if arg not present or 0 then seed chosen by system.
11 
12 // the addition of ilow > 0 means that value is used for the lowindex
13 // instead of the mcell_ran4_init global 32 bit lowindex.
14 
15 class MCellRan4: public RNG {
16  public:
17  MCellRan4(std::uint32_t ihigh = 0, std::uint32_t ilow = 0);
18  virtual ~MCellRan4();
19  virtual std::uint32_t asLong() {
20  return (std::uint32_t) (ilow_ == 0 ? mcell_iran4(&ihigh_) : nrnRan4int(&ihigh_, ilow_));
21  }
22  virtual void reset() {
23  ihigh_ = orig_;
24  }
25  virtual double asDouble() {
26  return (ilow_ == 0 ? mcell_ran4a(&ihigh_) : nrnRan4dbl(&ihigh_, ilow_));
27  }
28  std::uint32_t ihigh_;
29  std::uint32_t orig_;
30  std::uint32_t ilow_;
31 
32  private:
33  static std::uint32_t cnt_;
34 };
std::uint32_t orig_
std::uint32_t ilow_
std::uint32_t ihigh_
virtual void reset()
MCellRan4(std::uint32_t ihigh=0, std::uint32_t ilow=0)
Definition: MCellRan4RNG.cpp:3
virtual std::uint32_t asLong()
virtual ~MCellRan4()
virtual double asDouble()
static std::uint32_t cnt_
Definition: RNG.h:5
uint32_t nrnRan4int(uint32_t *idx1, uint32_t idx2)
Definition: mcran4.cpp:75
uint32_t mcell_iran4(uint32_t *high)
Definition: mcran4.cpp:71
double nrnRan4dbl(uint32_t *idx1, uint32_t idx2)
Definition: mcran4.cpp:117
double mcell_ran4a(uint32_t *high)
Definition: mcran4.cpp:67