votca 2026-dev
Loading...
Searching...
No Matches
votca::xtp::KMCRandom Class Reference

Random numbers for kinetic Monte Carlo: one independent stream per (seed, stream) pair. std::seed_seq and mt19937_64 are fully specified by the standard and the uniform numbers are built from the raw bits, so a stream is identical with every standard library (unlike std::uniform_real_distribution / std::normal_distribution). More...

#include <kmcrandom.h>

Public Member Functions

 KMCRandom (std::uint64_t seed, std::uint64_t stream)
double Uniform ()
 uniform in (0,1]
double Exponential (double rate)
 Exp(rate), i.e. -ln(u)/rate.
Index Integer (Index n)
 uniform integer in [0, n)
double Normal ()
 standard normal (Box-Muller)

Private Attributes

std::mt19937_64 engine_

Detailed Description

Random numbers for kinetic Monte Carlo: one independent stream per (seed, stream) pair. std::seed_seq and mt19937_64 are fully specified by the standard and the uniform numbers are built from the raw bits, so a stream is identical with every standard library (unlike std::uniform_real_distribution / std::normal_distribution).

Definition at line 42 of file kmcrandom.h.

Constructor & Destructor Documentation

◆ KMCRandom()

votca::xtp::KMCRandom::KMCRandom ( std::uint64_t seed,
std::uint64_t stream )

Definition at line 39 of file kmcengine.cc.

Member Function Documentation

◆ Exponential()

double votca::xtp::KMCRandom::Exponential ( double rate)
inline

Exp(rate), i.e. -ln(u)/rate.

Definition at line 50 of file kmcrandom.h.

◆ Integer()

Index votca::xtp::KMCRandom::Integer ( Index n)

uniform integer in [0, n)

Definition at line 47 of file kmcengine.cc.

◆ Normal()

double votca::xtp::KMCRandom::Normal ( )

standard normal (Box-Muller)

Definition at line 61 of file kmcengine.cc.

◆ Uniform()

double votca::xtp::KMCRandom::Uniform ( )
inline

uniform in (0,1]

Definition at line 46 of file kmcrandom.h.

Member Data Documentation

◆ engine_

std::mt19937_64 votca::xtp::KMCRandom::engine_
private

Definition at line 57 of file kmcrandom.h.


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