BioDynaMo  v1.05.120-25dc9790
random.h
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------
2 //
3 // Copyright (C) 2021 CERN & University of Surrey for the benefit of the
4 // BioDynaMo collaboration. All Rights Reserved.
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // See the LICENSE file distributed with this work for details.
10 // See the NOTICE file distributed with this work for additional information
11 // regarding copyright ownership.
12 //
13 // -----------------------------------------------------------------------------
14 
15 #ifndef CORE_UTIL_RANDOM_H_
16 #define CORE_UTIL_RANDOM_H_
17 
18 #include <unordered_map>
21 #include "core/util/root.h"
22 
23 class TRandom;
24 class TF1;
25 class TF2;
26 class TF3;
27 
28 namespace bdm {
29 
30 // -----------------------------------------------------------------------------
32 template <typename TSample>
34  public:
35  DistributionRng() = default;
36  DistributionRng(TRootIOCtor*) {}
37  virtual ~DistributionRng() = default;
39  TSample Sample();
46 
49  template <uint64_t N>
52  for (uint64_t i = 0; i < N; i++) {
53  ret[i] = Sample();
54  }
55  return ret;
56  }
57 
58  protected:
59  virtual TSample SampleImpl(TRandom* rng) = 0;
60  virtual MathArray<TSample, 2> Sample2Impl(TRandom* rng);
61  virtual MathArray<TSample, 3> Sample3Impl(TRandom* rng);
63 };
64 
65 // -----------------------------------------------------------------------------
66 class UniformRng : public DistributionRng<real_t> {
67  public:
68  UniformRng(real_t min, real_t max);
69  ~UniformRng() override;
70 
71  private:
73  real_t SampleImpl(TRandom* rng) override;
75 };
76 
77 // -----------------------------------------------------------------------------
78 class GausRng : public DistributionRng<real_t> {
79  public:
80  GausRng(real_t mean, real_t sigma);
81  virtual ~GausRng() override;
82 
83  private:
85  real_t SampleImpl(TRandom* rng) override;
87 };
88 
89 // -----------------------------------------------------------------------------
90 class ExpRng : public DistributionRng<real_t> {
91  public:
92  ExpRng(real_t tau);
93  ~ExpRng() override;
94 
95  private:
97  real_t SampleImpl(TRandom* rng) override;
99 };
100 
101 // -----------------------------------------------------------------------------
102 class LandauRng : public DistributionRng<real_t> {
103  public:
104  LandauRng(real_t mean, real_t sigma);
105  ~LandauRng() override;
106 
107  private:
109  real_t SampleImpl(TRandom* rng) override;
111 };
112 
113 // -----------------------------------------------------------------------------
114 class PoissonDRng : public DistributionRng<real_t> {
115  public:
116  PoissonDRng(real_t mean);
117  ~PoissonDRng() override;
118 
119  private:
121  real_t SampleImpl(TRandom* rng) override;
123 };
124 
125 // -----------------------------------------------------------------------------
126 class BreitWignerRng : public DistributionRng<real_t> {
127  public:
128  BreitWignerRng(real_t mean, real_t gamma);
129  ~BreitWignerRng() override;
130 
131  private:
133  real_t SampleImpl(TRandom* rng) override;
135 };
136 
137 // -----------------------------------------------------------------------------
138 class UserDefinedDistRng1D : public DistributionRng<real_t> {
139  public:
140  UserDefinedDistRng1D(TRootIOCtor* ioctor) : DistributionRng<real_t>(ioctor) {}
141  UserDefinedDistRng1D(TF1* function, const char* option);
142  ~UserDefinedDistRng1D() override;
143  void Draw(const char* option = "");
144  TF1* GetTF1();
145 
146  private:
147  real_t SampleImpl(TRandom* rng) override;
148  // TODO use shared_ptr once ROOT supports IO of them
149  TF1* function_ = nullptr;
150  const char* option_ = nullptr;
152 };
153 
154 // -----------------------------------------------------------------------------
155 class UserDefinedDistRng2D : public DistributionRng<real_t> {
156  public:
157  UserDefinedDistRng2D(TRootIOCtor* ioctor) : DistributionRng<real_t>(ioctor) {}
158  UserDefinedDistRng2D(TF2* function, const char* option);
159  ~UserDefinedDistRng2D() override;
160  void Draw(const char* option = "");
161  TF2* GetTF2();
162 
163  private:
164  real_t SampleImpl(TRandom* rng) override;
165  MathArray<real_t, 2> Sample2Impl(TRandom* rng) override;
166  // TODO use shared_ptr once ROOT supports IO of them
167  TF2* function_ = nullptr;
168  const char* option_ = nullptr;
170 };
171 
172 // -----------------------------------------------------------------------------
173 class UserDefinedDistRng3D : public DistributionRng<real_t> {
174  public:
175  UserDefinedDistRng3D(TRootIOCtor* ioctor) : DistributionRng<real_t>(ioctor) {}
176  UserDefinedDistRng3D(TF3* function, const char* option);
177  ~UserDefinedDistRng3D() override;
178  void Draw(const char* option = "");
179  TF3* GetTF3();
180 
181  private:
182  real_t SampleImpl(TRandom* rng) override;
183  MathArray<real_t, 2> Sample2Impl(TRandom* rng) override;
184  MathArray<real_t, 3> Sample3Impl(TRandom* rng) override;
185  // TODO use shared_ptr once ROOT supports IO of them
186  TF3* function_ = nullptr;
187  const char* option_ = nullptr;
189 };
190 
191 // -----------------------------------------------------------------------------
193  double (*ud_function)(const double*, const double*) = nullptr;
201  bool operator==(const UserDefinedDist& other) const {
202  return (ud_function == other.ud_function) &&
203  (parameters == other.parameters) && (xmin == other.xmin) &&
204  (xmax == other.xmax) && (ymin == other.ymin) &&
205  (ymax == other.ymax) && (zmin == other.zmin) && (zmax == other.zmax);
206  }
207 };
208 
209 } // namespace bdm
210 namespace std {
211 
212 template <>
213 struct hash<bdm::UserDefinedDist> {
214  std::size_t operator()(const bdm::UserDefinedDist& uddist) const noexcept {
215  std::size_t h = 7;
216  h *= 31 * reinterpret_cast<std::size_t>(uddist.ud_function);
217  for (auto el : uddist.parameters) {
218  h *= 31 * std::size_t(el * 1000);
219  }
220  h *= 31 * std::size_t(uddist.xmin * 1000);
221  h *= 31 * std::size_t(uddist.xmax * 1000);
222  h *= 31 * std::size_t(uddist.ymin * 1000);
223  h *= 31 * std::size_t(uddist.ymax * 1000);
224  h *= 31 * std::size_t(uddist.zmin * 1000);
225  h *= 31 * std::size_t(uddist.zmax * 1000);
226  return h;
227  }
228 };
229 
230 } // namespace std
231 namespace bdm {
232 
233 // -----------------------------------------------------------------------------
234 class BinomialRng : public DistributionRng<int> {
235  public:
236  BinomialRng(int ntot, real_t prob);
237  ~BinomialRng() override;
238 
239  private:
240  int ntot_;
242  int SampleImpl(TRandom* rng) override;
244 };
245 
246 // -----------------------------------------------------------------------------
247 class PoissonRng : public DistributionRng<int> {
248  public:
249  PoissonRng(real_t mean);
250  ~PoissonRng() override;
251 
252  private:
254  int SampleImpl(TRandom* rng) override;
256 };
257 
258 // -----------------------------------------------------------------------------
262 class Random {
263  public:
264  Random();
265  explicit Random(TRootIOCtor*);
266  Random(const Random& other);
267  ~Random();
268  Random& operator=(const Random& other);
269 
273  real_t Uniform(real_t max = 1.0);
277  real_t Uniform(real_t min, real_t max);
278 
280  template <uint64_t N>
283  for (uint64_t i = 0; i < N; i++) {
284  ret[i] = Uniform(max);
285  }
286  return ret;
287  }
288 
290  template <uint64_t N>
293  for (uint64_t i = 0; i < N; i++) {
294  ret[i] = Uniform(min, max);
295  }
296  return ret;
297  }
298 
301  real_t Gaus(real_t mean = 0.0, real_t sigma = 1.0);
304  real_t Exp(real_t tau);
307  real_t Landau(real_t mean = 0, real_t sigma = 1);
310  real_t PoissonD(real_t mean);
313  real_t BreitWigner(real_t mean = 0, real_t gamma = 1);
314 
317  unsigned Integer(int max);
320  int Binomial(int ntot, real_t prob);
323  int Poisson(real_t mean);
324 
331 
334  void SetSeed(uint64_t seed);
335 
338  uint64_t GetSeed() const;
339 
343  void SetGenerator(TRandom* new_rng);
344 
347  UniformRng GetUniformRng(real_t min = 0, real_t max = 1) const;
350  GausRng GetGausRng(real_t mean = 0, real_t sigma = 1) const;
353  ExpRng GetExpRng(real_t tau) const;
356  LandauRng GetLandauRng(real_t mean = 0, real_t sigma = 1) const;
359  PoissonDRng GetPoissonDRng(real_t mean) const;
362  BreitWignerRng GetBreitWignerRng(real_t mean = 0, real_t gamma = 1) const;
363 
397  double (*f)(const double*, const double*),
398  const FixedSizeVector<real_t, 10>& params, real_t min, real_t max,
399  const char* option = nullptr);
400 
403  double (*f)(const double*, const double*),
404  const FixedSizeVector<real_t, 10>& params, real_t xmin, real_t xmax,
405  real_t ymin, real_t ymax, const char* option = nullptr);
406 
409  double (*f)(const double*, const double*),
410  const FixedSizeVector<real_t, 10>& params, real_t xmin, real_t xmax,
411  real_t ymin, real_t ymax, real_t zmin, real_t zmax,
412  const char* option = nullptr);
413 
416  BinomialRng GetBinomialRng(int ntot, real_t prob) const;
419  PoissonRng GetPoissonRng(real_t mean) const;
420 
421  private:
422  friend class DistributionRng<real_t>;
423  friend class DistributionRng<int>;
424 
425  TRandom* generator_ = nullptr;
428  std::unordered_map<UserDefinedDist, TF1*> udd_tf1_map_;
429  std::unordered_map<UserDefinedDist, TF2*> udd_tf2_map_;
432  std::unordered_map<UserDefinedDist, TF3*> udd_tf3_map_;
436 };
437 
438 } // namespace bdm
439 
440 #endif // CORE_UTIL_RANDOM_H_
bdm::UserDefinedDistRng2D::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:275
bdm::Random::Gaus
real_t Gaus(real_t mean=0.0, real_t sigma=1.0)
Definition: random.cc:70
bdm::BreitWignerRng::gamma_
real_t gamma_
Definition: random.h:132
bdm::Random::Sphere
MathArray< real_t, 3 > Sphere(real_t radius)
Definition: random.cc:110
bdm::UserDefinedDistRng1D::function_
TF1 * function_
Definition: random.h:149
bdm::BinomialRng::SampleImpl
int SampleImpl(TRandom *rng) override
Definition: random.cc:354
bdm::FixedSizeVector< real_t, 10 >
bdm::UserDefinedDistRng3D::~UserDefinedDistRng3D
~UserDefinedDistRng3D() override
bdm::Random::GetGausRng
GausRng GetGausRng(real_t mean=0, real_t sigma=1) const
Definition: random.cc:189
bdm::Random::PoissonD
real_t PoissonD(real_t mean)
Definition: random.cc:83
bdm::UserDefinedDistRng2D::~UserDefinedDistRng2D
~UserDefinedDistRng2D() override
bdm::BreitWignerRng::mean_
real_t mean_
Definition: random.h:132
fixed_size_vector.h
bdm::PoissonRng::~PoissonRng
~PoissonRng() override
bdm::UserDefinedDistRng1D::UserDefinedDistRng1D
UserDefinedDistRng1D(TRootIOCtor *ioctor)
Definition: random.h:140
bdm::UserDefinedDistRng3D::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(UserDefinedDistRng3D, 1)
bdm::BinomialRng::BinomialRng
BinomialRng(int ntot, real_t prob)
Definition: random.cc:352
bdm::BreitWignerRng::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(BreitWignerRng, 1)
bdm::LandauRng::~LandauRng
~LandauRng() override
bdm::PoissonDRng::~PoissonDRng
~PoissonDRng() override
bdm::PoissonDRng
Definition: random.h:114
bdm::PoissonDRng::PoissonDRng
PoissonDRng(real_t mean)
Definition: random.cc:212
bdm::Random::GetUserDefinedDistRng3D
UserDefinedDistRng3D GetUserDefinedDistRng3D(double(*f)(const double *, const double *), const FixedSizeVector< real_t, 10 > &params, real_t xmin, real_t xmax, real_t ymin, real_t ymax, real_t zmin, real_t zmax, const char *option=nullptr)
Definition: random.cc:333
bdm::DistributionRng::Sample3
MathArray< TSample, 3 > Sample3()
Definition: random.cc:159
bdm::Random::Circle
MathArray< real_t, 2 > Circle(real_t radius)
Definition: random.cc:102
bdm::BinomialRng::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(BinomialRng, 1)
bdm::PoissonRng::mean_
real_t mean_
Definition: random.h:253
bdm
Definition: agent.cc:39
bdm::GausRng::sigma_
real_t sigma_
Definition: random.h:84
bdm::GausRng
Definition: random.h:78
bdm::Random::GetBreitWignerRng
BreitWignerRng GetBreitWignerRng(real_t mean=0, real_t gamma=1) const
Definition: random.cc:228
bdm::Random::GetExpRng
ExpRng GetExpRng(real_t tau) const
Definition: random.cc:198
bdm::UserDefinedDist::ymax
real_t ymax
Definition: random.h:198
bdm::Random::BreitWigner
real_t BreitWigner(real_t mean=0, real_t gamma=1)
Definition: random.cc:86
bdm::UserDefinedDistRng3D::function_
TF3 * function_
Definition: random.h:186
bdm::UserDefinedDist::ymin
real_t ymin
Definition: random.h:197
bdm::UserDefinedDistRng2D::function_
TF2 * function_
Definition: random.h:167
bdm::Random::operator=
Random & operator=(const Random &other)
Definition: random.cc:51
bdm::UserDefinedDist::zmin
real_t zmin
Definition: random.h:199
bdm::DistributionRng::SampleArray
MathArray< TSample, N > SampleArray()
Definition: random.h:50
bdm::PoissonDRng::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(PoissonDRng, 1)
bdm::UserDefinedDistRng1D::option_
const char * option_
Definition: random.h:150
bdm::BreitWignerRng
Definition: random.h:126
bdm::real_t
double real_t
Definition: real_t.h:21
bdm::PoissonDRng::mean_
real_t mean_
Definition: random.h:120
bdm::UserDefinedDistRng2D::option_
const char * option_
Definition: random.h:168
bdm::UserDefinedDist::operator==
bool operator==(const UserDefinedDist &other) const
Definition: random.h:201
bdm::Random::GetPoissonDRng
PoissonDRng GetPoissonDRng(real_t mean) const
Definition: random.cc:216
bdm::UserDefinedDist::zmax
real_t zmax
Definition: random.h:200
bdm::Random::BDM_CLASS_DEF_NV
BDM_CLASS_DEF_NV(Random, 3)
bdm::UserDefinedDistRng1D::~UserDefinedDistRng1D
~UserDefinedDistRng1D() override
bdm::Random::Poisson
int Poisson(real_t mean)
Definition: random.cc:99
bdm::DistributionRng::BDM_CLASS_DEF
BDM_CLASS_DEF(DistributionRng, 1)
bdm::Random::udd_tf1_map_
std::unordered_map< UserDefinedDist, TF1 * > udd_tf1_map_
Definition: random.h:428
bdm::Random
Definition: random.h:262
bdm::GausRng::mean_
real_t mean_
Definition: random.h:84
bdm::ExpRng
Definition: random.h:90
bdm::Random::Uniform
real_t Uniform(real_t max=1.0)
Definition: random.cc:62
bdm::Random::GetBinomialRng
BinomialRng GetBinomialRng(int ntot, real_t prob) const
Definition: random.cc:358
bdm::LandauRng::sigma_
real_t sigma_
Definition: random.h:108
bdm::UserDefinedDistRng3D::UserDefinedDistRng3D
UserDefinedDistRng3D(TRootIOCtor *ioctor)
Definition: random.h:175
bdm::UserDefinedDistRng2D
Definition: random.h:155
bdm::UniformRng
Definition: random.h:66
bdm::DistributionRng::Sample2Impl
virtual MathArray< TSample, 2 > Sample2Impl(TRandom *rng)
Definition: random.cc:151
bdm::BreitWignerRng::BreitWignerRng
BreitWignerRng(real_t mean, real_t gamma)
Definition: random.cc:221
bdm::UniformRng::max_
real_t max_
Definition: random.h:72
bdm::LandauRng::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:203
bdm::Random::Integer
unsigned Integer(int max)
Definition: random.cc:91
bdm::UserDefinedDistRng2D::Draw
void Draw(const char *option="")
Definition: random.cc:285
bdm::Random::Binomial
int Binomial(int ntot, real_t prob)
Definition: random.cc:94
bdm::ExpRng::~ExpRng
~ExpRng() override
bdm::DistributionRng::SampleImpl
virtual TSample SampleImpl(TRandom *rng)=0
bdm::Random::SetGenerator
void SetGenerator(TRandom *new_rng)
Definition: random.cc:124
bdm::UserDefinedDistRng3D::option_
const char * option_
Definition: random.h:187
bdm::BreitWignerRng::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:224
bdm::DistributionRng::Sample3Impl
virtual MathArray< TSample, 3 > Sample3Impl(TRandom *rng)
Definition: random.cc:168
bdm::LandauRng
Definition: random.h:102
bdm::UserDefinedDistRng3D::GetTF3
TF3 * GetTF3()
Definition: random.cc:331
bdm::Random::UniformArray
MathArray< real_t, N > UniformArray(real_t max=1.0)
Returns an array of uniform random numbers in the interval (0, max)
Definition: random.h:281
bdm::PoissonRng::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(PoissonRng, 1)
bdm::UserDefinedDistRng3D::Draw
void Draw(const char *option="")
Definition: random.cc:330
bdm::DistributionRng::DistributionRng
DistributionRng(TRootIOCtor *)
Definition: random.h:36
bdm::UserDefinedDistRng3D::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:314
bdm::UserDefinedDistRng1D::GetTF1
TF1 * GetTF1()
Definition: random.cc:246
bdm::ExpRng::ExpRng
ExpRng(real_t tau)
Definition: random.cc:194
root.h
bdm::Random::Random
Random()
Definition: random.cc:25
bdm::Random::Landau
real_t Landau(real_t mean=0, real_t sigma=1)
Definition: random.cc:78
bdm::UserDefinedDistRng1D::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:240
bdm::UserDefinedDistRng1D::Draw
void Draw(const char *option="")
Definition: random.cc:245
math_array.h
bdm::UserDefinedDistRng2D::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(UserDefinedDistRng2D, 1)
bdm::BinomialRng::~BinomialRng
~BinomialRng() override
bdm::ExpRng::tau_
real_t tau_
Definition: random.h:96
bdm::BinomialRng
Definition: random.h:234
bdm::BinomialRng::prob_
real_t prob_
Definition: random.h:241
bdm::Random::GetUserDefinedDistRng2D
UserDefinedDistRng2D GetUserDefinedDistRng2D(double(*f)(const double *, const double *), const FixedSizeVector< real_t, 10 > &params, real_t xmin, real_t xmax, real_t ymin, real_t ymax, const char *option=nullptr)
Definition: random.cc:288
bdm::BreitWignerRng::~BreitWignerRng
~BreitWignerRng() override
bdm::Random::udd_tf2_map_
std::unordered_map< UserDefinedDist, TF2 * > udd_tf2_map_
Definition: random.h:431
bdm::Random::UniformArray
MathArray< real_t, N > UniformArray(real_t min, real_t max)
Returns an array of uniform random numbers in the interval (min, max)
Definition: random.h:291
bdm::Random::GetUserDefinedDistRng1D
UserDefinedDistRng1D GetUserDefinedDistRng1D(double(*f)(const double *, const double *), const FixedSizeVector< real_t, 10 > &params, real_t min, real_t max, const char *option=nullptr)
Definition: random.cc:249
bdm::UserDefinedDist::xmax
real_t xmax
Definition: random.h:196
bdm::Random::GetUniformRng
UniformRng GetUniformRng(real_t min=0, real_t max=1) const
Definition: random.cc:180
bdm::UniformRng::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(UniformRng, 1)
bdm::UniformRng::~UniformRng
~UniformRng() override
bdm::UniformRng::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:178
bdm::ExpRng::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:196
bdm::DistributionRng::~DistributionRng
virtual ~DistributionRng()=default
bdm::UserDefinedDistRng3D::Sample2Impl
MathArray< real_t, 2 > Sample2Impl(TRandom *rng) override
Definition: random.cc:319
bdm::UserDefinedDist::ud_function
double(* ud_function)(const double *, const double *)
Definition: random.h:193
bdm::DistributionRng
Random number generator that generates samples from a distribution.
Definition: random.h:33
std
Definition: agent_uid.h:117
bdm::DistributionRng::Sample
TSample Sample()
Draws a sample from the distribution.
Definition: random.cc:133
bdm::UserDefinedDistRng3D::Sample3Impl
MathArray< real_t, 3 > Sample3Impl(TRandom *rng) override
Definition: random.cc:324
bdm::Random::Exp
real_t Exp(real_t tau)
Definition: random.cc:75
bdm::Random::GetPoissonRng
PoissonRng GetPoissonRng(real_t mean) const
Definition: random.cc:367
bdm::Random::GetSeed
uint64_t GetSeed() const
Definition: random.cc:121
bdm::UserDefinedDist::parameters
FixedSizeVector< real_t, 10 > parameters
Definition: random.h:194
bdm::UserDefinedDistRng2D::UserDefinedDistRng2D
UserDefinedDistRng2D(TRootIOCtor *ioctor)
Definition: random.h:157
bdm::UniformRng::UniformRng
UniformRng(real_t min, real_t max)
Definition: random.cc:176
bdm::PoissonRng::PoissonRng
PoissonRng(real_t mean)
Definition: random.cc:363
bdm::LandauRng::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(LandauRng, 1)
bdm::UserDefinedDistRng1D
Definition: random.h:138
bdm::Random::~Random
~Random()
Definition: random.cc:35
bdm::Random::GetLandauRng
LandauRng GetLandauRng(real_t mean=0, real_t sigma=1) const
Definition: random.cc:207
bdm::GausRng::GausRng
GausRng(real_t mean, real_t sigma)
Definition: random.cc:185
bdm::DistributionRng::DistributionRng
DistributionRng()=default
std::hash< bdm::UserDefinedDist >::operator()
std::size_t operator()(const bdm::UserDefinedDist &uddist) const noexcept
Definition: random.h:214
bdm::GausRng::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(GausRng, 1)
bdm::UniformRng::min_
real_t min_
Definition: random.h:72
bdm::MathArray
Definition: math_array.h:36
bdm::ExpRng::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(ExpRng, 1)
bdm::Random::generator_
TRandom * generator_
Definition: random.h:425
bdm::LandauRng::LandauRng
LandauRng(real_t mean, real_t sigma)
Definition: random.cc:201
bdm::PoissonRng::SampleImpl
int SampleImpl(TRandom *rng) override
Definition: random.cc:365
bdm::LandauRng::mean_
real_t mean_
Definition: random.h:108
bdm::GausRng::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:187
bdm::UserDefinedDistRng3D
Definition: random.h:173
bdm::BinomialRng::ntot_
int ntot_
Definition: random.h:240
bdm::GausRng::~GausRng
virtual ~GausRng() override
bdm::UserDefinedDist
Definition: random.h:192
bdm::UserDefinedDistRng2D::GetTF2
TF2 * GetTF2()
Definition: random.cc:286
bdm::PoissonDRng::SampleImpl
real_t SampleImpl(TRandom *rng) override
Definition: random.cc:214
bdm::Random::SetSeed
void SetSeed(uint64_t seed)
Definition: random.cc:118
bdm::UserDefinedDist::xmin
real_t xmin
Definition: random.h:195
bdm::UserDefinedDistRng1D::BDM_CLASS_DEF_OVERRIDE
BDM_CLASS_DEF_OVERRIDE(UserDefinedDistRng1D, 1)
bdm::PoissonRng
Definition: random.h:247
bdm::Random::udd_tf3_map_
std::unordered_map< UserDefinedDist, TF3 * > udd_tf3_map_
Definition: random.h:434
bdm::UserDefinedDistRng2D::Sample2Impl
MathArray< real_t, 2 > Sample2Impl(TRandom *rng) override
Definition: random.cc:280
bdm::DistributionRng::Sample2
MathArray< TSample, 2 > Sample2()
Definition: random.cc:142