72#ifndef __ADS_RandomNumbers
73 #define __ADS_RandomNumbers
115 std::uint64_t seed );
132 [[nodiscard]] std::uint64_t
min(
void )
const {
return( f_c == 0 ); }
134 [[nodiscard]] std::uint64_t
max(
void )
const {
135 return( f_m ? f_m - 1 : std::numeric_limits< std::uint64_t >::max() );
157 [[nodiscard]] std::uint64_t
period( std::uint64_t limit )
const;
174template< std::u
int64_t a , std::u
int64_t c , std::u
int64_t m >
177 static_assert( ( m == 0 ) || ( ( a < m ) && ( c < m ) ) ,
"a , c < m" );
190 static constexpr std::uint64_t
min(
void ) {
return( c == 0 ); }
192 static constexpr std::uint64_t
max(
void ) {
193 return( m ? m - 1 : std::numeric_limits< std::uint64_t >::max() );
224 const std::vector< double > & p );
242inline std::pair< double , double >
260inline double serialTest(
const std::vector< double > & U ,
int d );
299template<
class T ,
class R >
341template<
class T ,
class R >
354#include "ADS/numeric/impl/RandomNumbers.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The arithmetic of section 17.2 and of exercises 17.1-17.3, on unsigned integers of 64 bits:
the generator of LinearCongruential with fixed at compile time, meaning : a UniformRandomBitGenera...
Definition RandomNumbers.h:176
std::uint64_t result_type
the type of the numbers
Definition RandomNumbers.h:180
constexpr LinearCongruentialT(std::uint64_t seed=1)
the generator from
constexpr std::uint64_t operator()(void)
the next number,
static constexpr std::uint64_t max(void)
the largest number,
Definition RandomNumbers.h:192
bool operator==(const LinearCongruentialT &) const =default
whether the two generators are in the same state
static constexpr std::uint64_t min(void)
the least number, 1 if , 0 otherwise
Definition RandomNumbers.h:190
std::uint64_t result_type
the type of the numbers
Definition RandomNumbers.h:108
std::uint64_t min(void) const
the least number, 1 if as in std::linear_congruential_engine (0 is then a fixed point,...
Definition RandomNumbers.h:132
static LinearCongruential mmix(std::uint64_t seed=1)
the generator of Knuth for MMIX,
std::uint64_t period(std::uint64_t limit) const
the period, by walking the sequence, when it is at most ; 0 otherwise
std::uint64_t max(void) const
the largest number,
Definition RandomNumbers.h:134
LinearCongruential(std::uint64_t a, std::uint64_t c, std::uint64_t m, std::uint64_t seed)
the generator of multiplier , increment and modulus , from
std::uint64_t operator()(void)
the next number , by mulMod() and an addition that does not overflow (section 3.2....
static LinearCongruential minstd(std::uint64_t seed=1)
the generator of Park and Miller, , ,
double chiSquare(const std::vector< long > &Y, const std::vector< double > &p)
the chi-square statistic of the counts against the probabilities over samples
std::vector< T > reservoirSampling(const std::vector< T > &S, std::size_t n, R &g)
items from the sequence , as if it were a stream of unknown length; all of , in its order,...
double serialTest(const std::vector< double > &U, int d)
the chi-square statistic of the pairs of numbers in in cells, degrees of freedom
void shuffle(std::vector< T > &A, R &g)
the vector shuffled by , every permutation equally likely if is uniform on its range
std::pair< double, double > kolmogorovSmirnov(std::vector< double > U)
the statistics of Kolmogorov and Smirnov of the numbers in against the uniform distribution,...
LinearCongruentialT< 16807, 0, 2147483647 > MinStd
the generator of Park and Miller, , ,
Definition RandomNumbers.h:205
LinearCongruentialT< 6364136223846793005ULL, 1442695040888963407ULL, 0 > Mmix
the generator of Knuth for MMIX,
Definition RandomNumbers.h:208
std::vector< std::size_t > selectionSampling(std::size_t n, std::size_t N, R &g)
of the items , in order, by one pass
double spectralTest2(std::uint64_t a, std::uint64_t m)
the of the spectral test of the generator of multiplier and modulus