43 return 1u+
uint(std::numeric_limits<int>::max());
83 double range (
double start,
double bound);
84 double normal(
double mean=0.0,
double stdev=1.0);
111 return srcGen_.
u64();
175 : generator_{nucleus.getSeed()}
190 generator_.seed (nucleus.
getSeed());
199 return distribution (generator_);
209 uint upper{std::numeric_limits<int>::max()};
210 upper = bound < upper? bound : upper;
211 return distribute (std::uniform_int_distribution<int> (0, upper));
218 return distribute (std::uniform_int_distribution<int> {std::numeric_limits<int>::min()
219 ,std::numeric_limits<int>::max()});
226 return distribute (std::uniform_int_distribution<uint64_t> {std::numeric_limits<uint64_t>::min()
227 ,std::numeric_limits<uint64_t>::max()});
234 return range (0.0, 1.0);
241 return distribute (std::uniform_real_distribution<double>{start,bound});
248 return distribute (std::normal_distribution<double>{mean,stdev});
255 return distribute (std::uniform_int_distribution<lib::HashVal>{
lib::HashVal(1)});
286 if constexpr (GEN::max() < std::numeric_limits<typename GEN::result_type>::max())
287 return GEN::operator()() % (GEN::max()+1);
289 return GEN::operator()();
Adapter to protect against data corruption caused by concurrent access.
GEN::result_type operator()()
uint64_t getSeed() override
Seed(RandomSequencer &parent)
RandomSequencer & srcGen_
Access point to a selection of random number sources.
uint64_t u64()
random 64bit number from full range.
int i(uint bound=_iBOUND())
drop-in replacement for rand() % bound
double normal(double mean=0.0, double stdev=1.0)
normal distribution (gaussian)
HashVal hash()
non-zero hash value from full 64bit range
RandomSequencer(SeedNucleus &)
Build new generator, drawing seed from a virtual seed source.
double range(double start, double bound)
random double from designated interval (upper bound excluded)
auto distribute(DIST)
generic adapter: draw next number to use the given distribution
double uni()
random double drawn from interval [0.0 ... 1.0[
int i32()
random number from full integer range (incl. negative values)
void reseed(SeedNucleus &)
inject controlled randomisation
RandomSequencer(RandomSequencer< G > &)
Build new generator, drawing a seed from given parent generator.
Establishes a seed point for any instance or performance.
virtual uint64_t getSeed()=0
virtual ~SeedNucleus()
this is an interface
Hash value types and utilities.
Inclusion for common place integral types and constants.
Implementation namespace for support and library code.
SeedNucleus & seedFromDefaultGen()
draw seed another Generator from the default RandomSequencer
double ranRange(double start, double bound)
Random entropyGen
a global RandomSequencer seeded with real entropy
void randomiseRandomness()
inject true randomness into the defaultGen
int rani(uint bound=_iBOUND())
Random defaultGen
a global default RandomSequencer for mundane purposes
double ranNormal(double mean=0.0, double stdev=1.0)
size_t HashVal
a STL compatible hash value
auto buildCappedSubSequence(RandomSequencer< GEN > &src)
Mix-Ins to allow or prohibit various degrees of copying and cloning.