Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Rand48 Class Reference

A pseudo random number generator using the linear congruential algorithm with the following parameters: More...

Public Types

typedef uint32_t result_type
 

Public Member Functions

 Rand48 (uint32_t val=default_seed)
 
void seed (uint32_t val=default_seed)
 
void discard (unsigned long long z)
 
uint64_t raw ()
 
uint32_t operator() ()
 

Static Public Member Functions

static constexpr uint32_t min ()
 
static constexpr uint32_t max ()
 

Static Public Attributes

static constexpr result_type default_seed = 1u
 

Detailed Description

A pseudo random number generator using the linear congruential algorithm with the following parameters:

    Xn+1 = (aXn + c) mod m, where n >= 0

    a = 0x5DEECE66D,
    c = 0xB
    m = 2**48

It delivers results identical to the lrand48() function that is available on some systems.

Definition at line 53 of file Rand48.H.

Member Typedef Documentation

◆ result_type

typedef uint32_t result_type

Definition at line 82 of file Rand48.H.

Constructor & Destructor Documentation

◆ Rand48()

Rand48 ( uint32_t  val = default_seed)
inlineexplicit

Definition at line 91 of file Rand48.H.

Member Function Documentation

◆ min()

static constexpr uint32_t min ( )
inlinestaticconstexpr

Definition at line 100 of file Rand48.H.

◆ max()

static constexpr uint32_t max ( )
inlinestaticconstexpr

Definition at line 103 of file Rand48.H.

◆ seed()

void seed ( uint32_t  val = default_seed)
inline

Definition at line 106 of file Rand48.H.

Referenced by Random::Random().

Here is the caller graph for this function:

◆ discard()

void discard ( unsigned long long  z)
inline

Definition at line 112 of file Rand48.H.

◆ raw()

uint64_t raw ( )
inline

Definition at line 119 of file Rand48.H.

◆ operator()()

uint32_t operator() ( )
inline

Definition at line 128 of file Rand48.H.

Member Data Documentation

◆ default_seed

constexpr result_type default_seed = 1u
staticconstexpr

Definition at line 85 of file Rand48.H.


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