ComPWA
Common Partial-Wave-Analysis Framework
Random.hpp
Go to the documentation of this file.
1
// Copyright (c) 2015, 2017 The ComPWA Team.
2
// This file is part of the ComPWA framework, check
3
// https://github.com/ComPWA/ComPWA/license.txt for details.
4
5
#ifndef COMPWA_RANDOM_H_
6
#define COMPWA_RANDOM_H_
7
8
#include <random>
9
10
namespace
ComPWA
{
11
16
class
UniformRealNumberGenerator
{
17
public
:
18
virtual
~UniformRealNumberGenerator
() =
default
;
19
// generate random double in the range from [0,1)
20
virtual
double
operator()
() = 0;
21
virtual
int
getSeed
()
const
= 0;
22
virtual
void
setSeed
(
int
seed) = 0;
23
};
24
25
class
StdUniformRealGenerator
:
public
UniformRealNumberGenerator
{
26
std::mt19937
MersenneTwisterRandomGenerator
;
27
std::uniform_real_distribution<double>
UniformDistribution
;
28
int
Seed
;
29
30
public
:
31
StdUniformRealGenerator
(
int
seed = 123456);
32
33
double
operator()
() final;
34
int
getSeed
() const final;
35
void
setSeed
(
int
seed) final;
36
};
37
38
}
// namespace ComPWA
39
40
#endif
ComPWA::StdUniformRealGenerator::MersenneTwisterRandomGenerator
std::mt19937 MersenneTwisterRandomGenerator
Definition:
Random.hpp:26
ComPWA
Definition:
Efficiency.cpp:7
ComPWA::UniformRealNumberGenerator::~UniformRealNumberGenerator
virtual ~UniformRealNumberGenerator()=default
ComPWA::UniformRealNumberGenerator
Definition:
Random.hpp:16
ComPWA::StdUniformRealGenerator
Definition:
Random.hpp:25
ComPWA::UniformRealNumberGenerator::operator()
virtual double operator()()=0
ComPWA::UniformRealNumberGenerator::getSeed
virtual int getSeed() const =0
ComPWA::StdUniformRealGenerator::UniformDistribution
std::uniform_real_distribution< double > UniformDistribution
Definition:
Random.hpp:27
ComPWA::StdUniformRealGenerator::Seed
int Seed
Definition:
Random.hpp:28
ComPWA::UniformRealNumberGenerator::setSeed
virtual void setSeed(int seed)=0
Core
Random.hpp
Generated on Mon Jun 22 2020 13:03:33 for ComPWA by
1.8.13