Kepler's Torus
Public Member Functions | Public Attributes | List of all members
Uniform Struct Reference

#include <uniform.h>

Inheritance diagram for Uniform:
Inheritance graph
[legend]
Collaboration diagram for Uniform:
Collaboration graph
[legend]

Public Member Functions

 Uniform (Bounds bounds)
 
 Uniform (Bounds bounds, unsigned int seed)
 
double random ()
 
- Public Member Functions inherited from Distribution
 Distribution (std::size_t seed)
 Create a new random number distribution with the given seed.
 
virtual ~Distribution ()=0
 Make this class abstract.
 

Public Attributes

std::uniform_real_distribution< double > realDistribution
 
Bounds const bounds
 
- Public Attributes inherited from Distribution
std::size_t const seed
 Seed used to initialise the random number generator.
 
std::mt19937 mt
 Mersenne Twister pseudo-random number generator, initialised by the given seed and used to generate numbers.
 

Detailed Description

Uniform probabilistic distribution, provides a very random but seeded random generator

Definition at line 8 of file uniform.h.

Constructor & Destructor Documentation

◆ Uniform() [1/2]

Uniform::Uniform ( Bounds  bounds)
inlineexplicit

Constructs a Random Generator generating numbers uniformly distributed. Randomly produces a seed

Parameters
lowerBoundis the lowest possible number appearing
upperBoundis the lowest number above lowerBound impossible to appear

Definition at line 18 of file uniform.h.

18  :
19  Uniform (bounds, generateSeed()) {}
Uniform(Bounds bounds)
Definition: uniform.h:18

◆ Uniform() [2/2]

Uniform::Uniform ( Bounds  bounds,
unsigned int  seed 
)
inline

Constructs a Random Generator generating numbers uniformly distributed, based on the seed given

Parameters
lowerBoundis the lowest possible number appearing
upperBoundis the lowers number above lowerBound impossible to appear
seedis determining the resulting numbers; the same seed always results in the same numbers

Definition at line 25 of file uniform.h.

25  :
27  bounds {bounds},
28  realDistribution (bounds.lower, bounds.upper) {}
Distribution(std::size_t seed)
Create a new random number distribution with the given seed.
Definition: distribution.cpp:3
std::uniform_real_distribution< double > realDistribution
Definition: uniform.h:10
std::size_t const seed
Seed used to initialise the random number generator.
Definition: distribution.h:14

Member Function Documentation

◆ random()

double Uniform::random ( )
inline

Returns a double randomly generated uniformly between the two bounds, based on the internal seed of the distribution

Definition at line 31 of file uniform.h.

31  {
32  return realDistribution (mt);
33  }
std::mt19937 mt
Mersenne Twister pseudo-random number generator, initialised by the given seed and used to generate n...
Definition: distribution.h:16
std::uniform_real_distribution< double > realDistribution
Definition: uniform.h:10

Member Data Documentation

◆ bounds

Bounds const Uniform::bounds

Boundaries between numbers should be generated

Definition at line 13 of file uniform.h.

◆ realDistribution

std::uniform_real_distribution<double> Uniform::realDistribution

Uniform real pseudo-random number distribution

Definition at line 10 of file uniform.h.


The documentation for this struct was generated from the following file: