Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
random_source_test.cc File Reference

SplitMix64_Rng against its reference, and Random_Source against the generators that it draws from. More...

#include <gtest/gtest.h>
#include <ah-random.H>
#include <ah_init_guard.H>
#include <tpl_array.H>
#include <tpl_dynSetTree.H>
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <limits>
#include <numeric>
#include <optional>
#include <random>
#include <stdexcept>
#include <thread>
#include <type_traits>
#include <utility>
Include dependency graph for random_source_test.cc:

Go to the source code of this file.

Functions

 TEST (SplitMix64Rng, TheNumbersOfItsReference)
 
 TEST (SplitMix64Rng, TheNumberIsTheMixOfTheStateAdvancedByTheIncrement)
 
 TEST (SplitMix64Rng, IsAConstantExpression)
 
 TEST (SplitMix64Rng, TheDefaultSeedIsZero)
 
 TEST (SplitMix64Rng, SeedingAgainIsAsBuildingWithTheSeed)
 
 TEST (SplitMix64Rng, ACopyGoesOnWithTheSameNumbers)
 
 TEST (SplitMix64Rng, FeedsTheStandardLibrary)
 
 TEST (SplitMix64Rng, ItsBitsAreBalanced)
 
 TEST (RandomDetail, BoundedIsExactWithEveryBoundOfWordsOf8Bits)
 
 TEST (RandomDetail, BoundedIsExactWithWordsOf16Bits)
 
 TEST (RandomDetail, MaskedIsExactWithEveryBoundOfWordsOf8Bits)
 
 TEST (RandomDetail, MaskedIsExactWithWordsOf16Bits)
 
 TEST (RandomDetail, TheSeedsOfTheirOwnAreNumbersOfOneSplitMix64)
 
 TEST (RandomDetail, WhatSeedsTheSplitMix64OfTheProcessChangesWithTheClocks)
 
 TEST (RandomDetail, TheSplitMix64OfTheProcessDoesNotStartFromAFixedState)
 
 TEST (RandomSource, WhatCannotThrowIsNoexceptAndItIsNotCopied)
 
 TEST (RandomSource, ByDefaultItDrawsFromASplitMix64WithASeedOfItsOwn)
 
 TEST (RandomSource, EachOneBuiltByDefaultHasItsOwnNumbersFromEveryThread)
 
 TEST (RandomSource, TheFirstNumbersOfSourcesSeededAsByDefaultAreUniform)
 
 TEST (RandomSource, WithASeedAloneEveryDrawIsThatOfSplitMix64)
 
 TEST (RandomSource, WithTheMersenneTwisterEveryDrawIsThatOfGslCompatibleRng)
 
 TEST (RandomSource, TheNumbersOfTheMersenneTwisterAreThoseOfTheStandard)
 
 TEST (RandomSource, AnIntegerBelowABoundAboveThe32BitsIsANumberOf64BitsUnderAMask)
 
 TEST (RandomSource, TheIntegersBelowABoundAreUniform)
 
 TEST (RandomSource, TheRealsAreUniformInTheUnitInterval)
 
 TEST (RandomSource, AnIntegerBelowZeroValuesIsRejectedAndTakesNoNumber)
 
 TEST (RandomSource, TheIntegerBelowOneValueIsZero)
 
 TEST (RandomSource, ASeedOfTheMersenneTwisterGivesTheSameNumbersOnEveryPlatform)
 
 TEST (RandomSource, ASeedChoosesTheEngine)
 
 TEST (RandomSource, ItsMersenneTwisterIsSeededWithTheNextNumberOfItsSplitMix64)
 
 TEST (RandomSource, AMoveTakesTheGeneratorAndLeavesASplitMix64WithASeedOfItsOwn)
 
 TEST (RandomSource, AnAssignmentToItselfLeavesItAsItWas)
 
 TEST (RandomSource, ASwapExchangesTheGeneratorsWithTheirStates)
 
 TEST (RandomSource, TwoAreEqualWhenTheyGiveTheSameNumbersFromNowOn)
 
 TEST (RandomSource, FeedsTheStandardLibrary)
 
 TEST (RandomSource, ItsGslRngActsOnItsMersenneTwister)
 

Detailed Description

SplitMix64_Rng against its reference, and Random_Source against the generators that it draws from.

The numbers of SplitMix64_Rng are compared with those that the SplittableRandom of Java, the implementation of its authors, gives for each seed. The draws of a Random_Source are compared with those of a twin generator: a Gsl_Compatible_Rng, which ah_random_test compares with GSL, or a SplitMix64_Rng through the method of each draw, written here as its definition and not as the header writes it. The two methods that give an integer below a bound are run with words of 8 and 16 bits on every number: each integer must come from as many numbers.

Definition in file random_source_test.cc.

Function Documentation

◆ TEST() [1/36]

TEST ( RandomDetail  ,
BoundedIsExactWithEveryBoundOfWordsOf8Bits   
)

Definition at line 428 of file random_source_test.cc.

◆ TEST() [2/36]

TEST ( RandomDetail  ,
BoundedIsExactWithWordsOf16Bits   
)

Definition at line 434 of file random_source_test.cc.

◆ TEST() [3/36]

TEST ( RandomDetail  ,
MaskedIsExactWithEveryBoundOfWordsOf8Bits   
)

Definition at line 443 of file random_source_test.cc.

◆ TEST() [4/36]

TEST ( RandomDetail  ,
MaskedIsExactWithWordsOf16Bits   
)

Definition at line 449 of file random_source_test.cc.

◆ TEST() [5/36]

TEST ( RandomDetail  ,
TheSeedsOfTheirOwnAreNumbersOfOneSplitMix64   
)

◆ TEST() [6/36]

TEST ( RandomDetail  ,
TheSplitMix64OfTheProcessDoesNotStartFromAFixedState   
)

◆ TEST() [7/36]

TEST ( RandomDetail  ,
WhatSeedsTheSplitMix64OfTheProcessChangesWithTheClocks   
)

◆ TEST() [8/36]

TEST ( RandomSource  ,
AMoveTakesTheGeneratorAndLeavesASplitMix64WithASeedOfItsOwn   
)

◆ TEST() [9/36]

TEST ( RandomSource  ,
AnAssignmentToItselfLeavesItAsItWas   
)

Definition at line 948 of file random_source_test.cc.

References engine.

◆ TEST() [10/36]

TEST ( RandomSource  ,
AnIntegerBelowABoundAboveThe32BitsIsANumberOf64BitsUnderAMask   
)

Definition at line 696 of file random_source_test.cc.

References k, seed, and Aleph::Random_Source::uniform_int_ne().

◆ TEST() [11/36]

TEST ( RandomSource  ,
AnIntegerBelowZeroValuesIsRejectedAndTakesNoNumber   
)

Definition at line 769 of file random_source_test.cc.

References engine, and Aleph::Random_Source::uniform_int().

◆ TEST() [12/36]

TEST ( RandomSource  ,
ASeedChoosesTheEngine   
)

◆ TEST() [13/36]

TEST ( RandomSource  ,
ASeedOfTheMersenneTwisterGivesTheSameNumbersOnEveryPlatform   
)

◆ TEST() [14/36]

TEST ( RandomSource  ,
ASwapExchangesTheGeneratorsWithTheirStates   
)

◆ TEST() [15/36]

TEST ( RandomSource  ,
ByDefaultItDrawsFromASplitMix64WithASeedOfItsOwn   
)

◆ TEST() [16/36]

TEST ( RandomSource  ,
EachOneBuiltByDefaultHasItsOwnNumbersFromEveryThread   
)

◆ TEST() [17/36]

TEST ( RandomSource  ,
FeedsTheStandardLibrary   
)

Definition at line 1008 of file random_source_test.cc.

References engine, and w.

◆ TEST() [18/36]

TEST ( RandomSource  ,
ItsGslRngActsOnItsMersenneTwister   
)

Definition at line 1060 of file random_source_test.cc.

◆ TEST() [19/36]

TEST ( RandomSource  ,
ItsMersenneTwisterIsSeededWithTheNextNumberOfItsSplitMix64   
)

◆ TEST() [20/36]

TEST ( RandomSource  ,
TheFirstNumbersOfSourcesSeededAsByDefaultAreUniform   
)

Definition at line 587 of file random_source_test.cc.

◆ TEST() [21/36]

TEST ( RandomSource  ,
TheIntegerBelowOneValueIsZero   
)

◆ TEST() [22/36]

TEST ( RandomSource  ,
TheIntegersBelowABoundAreUniform   
)

Definition at line 720 of file random_source_test.cc.

References engine, and Aleph::Random_Source::uniform_int().

◆ TEST() [23/36]

TEST ( RandomSource  ,
TheNumbersOfTheMersenneTwisterAreThoseOfTheStandard   
)

Definition at line 685 of file random_source_test.cc.

◆ TEST() [24/36]

TEST ( RandomSource  ,
TheRealsAreUniformInTheUnitInterval   
)

Definition at line 746 of file random_source_test.cc.

References engine, and Aleph::Random_Source::uniform().

◆ TEST() [25/36]

TEST ( RandomSource  ,
TwoAreEqualWhenTheyGiveTheSameNumbersFromNowOn   
)

Definition at line 984 of file random_source_test.cc.

References engine.

◆ TEST() [26/36]

◆ TEST() [27/36]

TEST ( RandomSource  ,
WithASeedAloneEveryDrawIsThatOfSplitMix64   
)

◆ TEST() [28/36]

◆ TEST() [29/36]

TEST ( SplitMix64Rng  ,
ACopyGoesOnWithTheSameNumbers   
)

Definition at line 372 of file random_source_test.cc.

◆ TEST() [30/36]

TEST ( SplitMix64Rng  ,
FeedsTheStandardLibrary   
)

Definition at line 387 of file random_source_test.cc.

References w.

◆ TEST() [31/36]

TEST ( SplitMix64Rng  ,
IsAConstantExpression   
)

◆ TEST() [32/36]

TEST ( SplitMix64Rng  ,
ItsBitsAreBalanced   
)

Definition at line 403 of file random_source_test.cc.

◆ TEST() [33/36]

TEST ( SplitMix64Rng  ,
SeedingAgainIsAsBuildingWithTheSeed   
)

Definition at line 357 of file random_source_test.cc.

References Aleph::SplitMix64_Rng::seed().

◆ TEST() [34/36]

TEST ( SplitMix64Rng  ,
TheDefaultSeedIsZero   
)

Definition at line 350 of file random_source_test.cc.

◆ TEST() [35/36]

TEST ( SplitMix64Rng  ,
TheNumberIsTheMixOfTheStateAdvancedByTheIncrement   
)

◆ TEST() [36/36]

TEST ( SplitMix64Rng  ,
TheNumbersOfItsReference   
)

Definition at line 307 of file random_source_test.cc.