31 #include "lib/integral.hpp" 43 return 1u+uint(std::numeric_limits<int>::max());
52 virtual uint64_t getSeed() =0;
79 int i(uint bound =_iBOUND());
83 double range (
double start,
double bound);
84 double normal(
double mean=0.0,
double stdev=1.0);
89 auto distribute(DIST);
111 return srcGen_.
u64();
137 return defaultGen.
i(bound);
144 return defaultGen.
range (start, bound);
148 ranNormal(
double mean =0.0,
double stdev =1.0)
150 return defaultGen.
normal (mean, stdev);
157 return defaultGen.
hash();
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)});
283 typename GEN::result_type
286 if constexpr (GEN::max() < std::numeric_limits<typename GEN::result_type>::max())
287 return GEN::operator()() % (GEN::max()+1);
289 return GEN::operator()();
virtual ~SeedNucleus()
this is an interface
Access point to a selection of random number sources.
int i(uint bound=_iBOUND())
drop-in replacement for rand() % bound
int rani(uint bound=_iBOUND())
RandomSequencer(SeedNucleus &)
Build new generator, drawing seed from a virtual seed source.
double ranRange(double start, double bound)
Random entropyGen
a global RandomSequencer seeded with real entropy
Implementation namespace for support and library code.
double range(double start, double bound)
random double from designated interval (upper bound excluded)
SeedNucleus & seedFromDefaultGen()
draw seed another Generator from the default RandomSequencer
Mix-Ins to allow or prohibit various degrees of copying and cloning.
uint64_t u64()
random 64bit number from full range.
Establishes a seed point for any instance or performance.
HashVal hash()
non-zero hash value from full 64bit range
Hash value types and utilities.
size_t HashVal
a STL compatible hash value
Adapter to protect against data corruption caused by concurrent access.
double normal(double mean=0.0, double stdev=1.0)
normal distribution (gaussian)
Random defaultGen
a global default RandomSequencer for mundane purposes
void randomiseRandomness()
inject true randomness into the defaultGen