rippled
Classes | Public Types | Public Member Functions | Public Attributes | Private Member Functions | List of all members
ripple::NodeStore::uniformIntDistribution< IntType > Struct Template Reference

std::uniform_int_distribution is platform dependent. More...

Classes

struct  paramType
 

Public Types

using resultType = IntType
 

Public Member Functions

 uniformIntDistribution (const resultType a=0, const resultType b=std::numeric_limits< resultType >::max())
 
 uniformIntDistribution (const paramType &params)
 
template<class Generator >
resultType operator() (Generator &g) const
 
template<class Generator >
resultType operator() (Generator &g, const paramType &params) const
 
resultType a () const
 
resultType b () const
 
resultType min () const
 
resultType max () const
 

Public Attributes

const resultType A
 
const resultType B
 

Private Member Functions

template<class Generator >
resultType rnd (Generator &g, const resultType a, const resultType b) const
 

Detailed Description

template<class IntType = int>
struct ripple::NodeStore::uniformIntDistribution< IntType >

std::uniform_int_distribution is platform dependent.

Unit test for deterministic shards is the following: it generates predictable accounts and transactions, packs them into ledgers and makes the shard. The hash of this shard should be equal to the given value. On different platforms (precisely, Linux and Mac) hashes of the resulting shard was different. It was unvestigated that the problem is in the class std::uniform_int_distribution which generates different pseudorandom sequences on different platforms, but we need predictable sequence.

Definition at line 60 of file DatabaseShard_test.cpp.

Member Typedef Documentation

◆ resultType

template<class IntType = int>
using ripple::NodeStore::uniformIntDistribution< IntType >::resultType = IntType

Definition at line 62 of file DatabaseShard_test.cpp.

Constructor & Destructor Documentation

◆ uniformIntDistribution() [1/2]

template<class IntType = int>
ripple::NodeStore::uniformIntDistribution< IntType >::uniformIntDistribution ( const resultType  a = 0,
const resultType  b = std::numeric_limits<resultType>::max() 
)
explicit

Definition at line 75 of file DatabaseShard_test.cpp.

◆ uniformIntDistribution() [2/2]

template<class IntType = int>
ripple::NodeStore::uniformIntDistribution< IntType >::uniformIntDistribution ( const paramType params)
explicit

Definition at line 82 of file DatabaseShard_test.cpp.

Member Function Documentation

◆ operator()() [1/2]

template<class IntType = int>
template<class Generator >
resultType ripple::NodeStore::uniformIntDistribution< IntType >::operator() ( Generator &  g) const

Definition at line 89 of file DatabaseShard_test.cpp.

◆ operator()() [2/2]

template<class IntType = int>
template<class Generator >
resultType ripple::NodeStore::uniformIntDistribution< IntType >::operator() ( Generator &  g,
const paramType params 
) const

Definition at line 96 of file DatabaseShard_test.cpp.

◆ a()

template<class IntType = int>
resultType ripple::NodeStore::uniformIntDistribution< IntType >::a ( ) const

Definition at line 102 of file DatabaseShard_test.cpp.

◆ b()

template<class IntType = int>
resultType ripple::NodeStore::uniformIntDistribution< IntType >::b ( ) const

Definition at line 108 of file DatabaseShard_test.cpp.

◆ min()

template<class IntType = int>
resultType ripple::NodeStore::uniformIntDistribution< IntType >::min ( ) const

Definition at line 114 of file DatabaseShard_test.cpp.

◆ max()

template<class IntType = int>
resultType ripple::NodeStore::uniformIntDistribution< IntType >::max ( ) const

Definition at line 120 of file DatabaseShard_test.cpp.

◆ rnd()

template<class IntType = int>
template<class Generator >
resultType ripple::NodeStore::uniformIntDistribution< IntType >::rnd ( Generator &  g,
const resultType  a,
const resultType  b 
) const
private

Definition at line 128 of file DatabaseShard_test.cpp.

Member Data Documentation

◆ A

template<class IntType = int>
const resultType ripple::NodeStore::uniformIntDistribution< IntType >::A

Definition at line 64 of file DatabaseShard_test.cpp.

◆ B

template<class IntType = int>
const resultType ripple::NodeStore::uniformIntDistribution< IntType >::B

Definition at line 64 of file DatabaseShard_test.cpp.