ARTS 2.5.9 (git: 825fa5f2)
Rng Class Reference

#include <rng.h>

Public Member Functions

 Rng ()
 Constructor creates instance of gsl_rng of type gsl_rng_mt19937. More...
 
 ~Rng ()
 Destructor frees memory allocated to gsl_rng. More...
 
void seed (unsigned long int n, const Verbosity &verbosity)
 Seeds the Rng with the integer argument. More...
 
void force_seed (unsigned long int n)
 Seeds the Rng with the integer argument. More...
 
double draw ()
 Draws a double from the uniform distribution [0,1) More...
 
unsigned long int showseed () const
 Returns the seed number. More...
 

Private Attributes

gsl_rngr
 
unsigned long int seed_no
 

Detailed Description

Definition at line 554 of file rng.h.

Constructor & Destructor Documentation

◆ Rng()

Rng::Rng ( )

Constructor creates instance of gsl_rng of type gsl_rng_mt19937.

Definition at line 47 of file rng.cc.

References gsl_rng_alloc(), gsl_rng_mt19937, and r.

◆ ~Rng()

Rng::~Rng ( )

Destructor frees memory allocated to gsl_rng.

Definition at line 52 of file rng.cc.

References gsl_rng_free(), and r.

Member Function Documentation

◆ draw()

double Rng::draw ( )

Draws a double from the uniform distribution [0,1)

Definition at line 97 of file rng.cc.

References gsl_rng_uniform(), and r.

Referenced by MCGeneral(), mcPathTraceGeneral(), mcPathTraceRadar(), MCRadar(), ran_gaussian(), ran_uniform(), Sample_los(), and Sample_los_uniform().

◆ force_seed()

void Rng::force_seed ( unsigned long int  n)

Seeds the Rng with the integer argument.

Definition at line 89 of file rng.cc.

References gsl_rng_set(), r, and seed_no.

◆ seed()

void Rng::seed ( unsigned long int  n,
const Verbosity verbosity 
)

Seeds the Rng with the integer argument.

Every seed is only used once. The provided seed is increased by 1 until an unused seed is found.

The default is to seed the Rng using the seconds elapsed since 1970.

Definition at line 54 of file rng.cc.

References CREATE_OUT0, gsl_rng_set(), r, and seed_no.

Referenced by MCGeneral(), MCRadar(), and psd_cloudice_MH97().

◆ showseed()

unsigned long int Rng::showseed ( ) const

Returns the seed number.

Definition at line 102 of file rng.cc.

References seed_no.

Member Data Documentation

◆ r

gsl_rng* Rng::r
private

Definition at line 555 of file rng.h.

Referenced by draw(), force_seed(), Rng(), seed(), and ~Rng().

◆ seed_no

unsigned long int Rng::seed_no
private

Definition at line 557 of file rng.h.

Referenced by force_seed(), seed(), and showseed().


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