CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Prng Class Reference

#include <prng.h>

Public Member Functions

 Prng () throw ()
 
void InitSeed (const uint64_t seed)
 
void InitLocaltime ()
 
uint32_t Next (const uint64_t boundary)
 
double NextDouble ()
 
double NextNormal ()
 

Private Attributes

uint64_t state_
 

Static Private Attributes

static const uint64_t a = 6364136223846793005LLU
 
static const uint64_t c = 1442695040888963407LLU
 

Detailed Description

This file is part of the CernVM File System.

A simple linear congruential pseudo number generator. Thread-safe since there is no global state like with random(). Pseudo Random Number Generator. See: TAoCP, volume 2

Definition at line 25 of file prng.h.

Constructor & Destructor Documentation

Prng::Prng ( )
throw (
)
inline

Definition at line 28 of file prng.h.

Member Function Documentation

void Prng::InitLocaltime ( )
inline

Definition at line 36 of file prng.h.

Referenced by NfsMapsSqlite::BusyHandlerInfo::BusyHandlerInfo(), signature::SignatureManager::GenerateCertificate(), shash::Digest< 16, kMd5 >::Randomize(), dns::Resolver::Resolver(), and s3fanout::S3FanoutManager::S3FanoutManager().

Here is the call graph for this function:

Here is the caller graph for this function:

void Prng::InitSeed ( const uint64_t  seed)
inline

Definition at line 32 of file prng.h.

Referenced by shash::Digest< 16, kMd5 >::Randomize().

Here is the caller graph for this function:

uint32_t Prng::Next ( const uint64_t  boundary)
inline
double Prng::NextDouble ( )
inline

Returns random double in range [0, 1]

Definition at line 57 of file prng.h.

double Prng::NextNormal ( )
inline

Returns normally distributed random numbers with mean 0 and variance 1 using the Box-Muller transform algorithm

Definition at line 68 of file prng.h.

Member Data Documentation

const uint64_t Prng::a = 6364136223846793005LLU
staticprivate

Definition at line 81 of file prng.h.

const uint64_t Prng::c = 1442695040888963407LLU
staticprivate

Definition at line 82 of file prng.h.

uint64_t Prng::state_
private

Definition at line 83 of file prng.h.


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