Medial Code Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions
xgboost::SimpleLCG Class Reference

Linear congruential generator. More...

#include <helpers.h>

Public Types

using result_type = StateType
 

Public Member Functions

 SimpleLCG (SimpleLCG const &that)=default
 
 SimpleLCG (SimpleLCG &&that)=default
 
void Seed (StateType seed)
 
 SimpleLCG (StateType state)
 Initialize SimpleLCG.
 
StateType operator() ()
 
StateType Min () const
 
StateType Max () const
 

Static Public Member Functions

constexpr static result_type min ()
 
constexpr static result_type max ()
 

Detailed Description

Linear congruential generator.

The distribution defined in std is not portable. Given the same seed, it migth produce different outputs on different platforms or with different compilers. The SimpleLCG implemented here is to make sure all tests are reproducible.

Constructor & Destructor Documentation

◆ SimpleLCG()

xgboost::SimpleLCG::SimpleLCG ( StateType  state)
inlineexplicit

Initialize SimpleLCG.

Parameters
stateInitial state, can also be considered as seed. If set to zero, SimpleLCG will use internal default value.

The documentation for this class was generated from the following files: