scc  2022.4.0
SystemC components library
scc::MT19937 Class Reference

a mersenne-twister based random number generator More...

#include <mt19937_rng.h>

Static Public Member Functions

static void seed (uint64_t new_seed=std::mt19937_64::default_seed)
 
static void enable_global_seed (bool enable)
 
static uint64_t uniform ()
 
template<typename T >
static T uniform ()
 
static uint64_t uniform (uint64_t min, uint64_t max)
 
static double normal ()
 
static double lognormal ()
 

Detailed Description

a mersenne-twister based random number generator

This random number generator provides various distribution of random numbers being specific to the SystemC process invoking the generator function. This makes the generator independent of the order of invocation in a delta cycle and allows to replay with the same seed

Definition at line 38 of file mt19937_rng.h.

Member Function Documentation

◆ enable_global_seed()

void scc::MT19937::enable_global_seed ( bool  enable)
static

By default each SystemC process has its own MT rng with a modified seed based on the process name. If set to true each MT rng gets exactly the same seed thus producing the same sequence.

Parameters
enableuse the same seed for all MT rng instances

Definition at line 69 of file mt19937_rng.cpp.

◆ lognormal()

static double scc::MT19937::lognormal ( )
inlinestatic

generates the next random integer number with log normal distribution (similar to rand() )

Returns

Definition at line 99 of file mt19937_rng.h.

◆ normal()

static double scc::MT19937::normal ( )
inlinestatic

generates the next random double precision float number with normal distribution (similar to rand() )

Returns

Definition at line 90 of file mt19937_rng.h.

◆ seed()

void scc::MT19937::seed ( uint64_t  new_seed = std::mt19937_64::default_seed)
static

Seeds the mersenne twister PRNG with the given value

Parameters
new_seed

Definition at line 62 of file mt19937_rng.cpp.

◆ uniform() [1/3]

static uint64_t scc::MT19937::uniform ( )
inlinestatic

generates the next random integer number with uniform distribution (similar to rand() )

Returns

Definition at line 60 of file mt19937_rng.h.

◆ uniform() [2/3]

template<typename T >
static T scc::MT19937::uniform ( )
inlinestatic

generates the next random integer number with uniform distribution in the range of the given type

Returns

Definition at line 69 of file mt19937_rng.h.

◆ uniform() [3/3]

static uint64_t scc::MT19937::uniform ( uint64_t  min,
uint64_t  max 
)
inlinestatic

generates the next random integer number with uniform distribution between (and including) min and max

Parameters
minthe lower limit of the interval
maxthe upper limit of the interval
Returns

Definition at line 80 of file mt19937_rng.h.


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