CernVM-FS  2.12.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 28 of file prng.h.

Constructor & Destructor Documentation

Prng::Prng ( )
throw (

Definition at line 31 of file prng.h.

Member Function Documentation

void Prng::InitLocaltime ( )
void Prng::InitSeed ( const uint64_t  seed)

Definition at line 35 of file prng.h.

Referenced by shash::Digest< 16, kMd5 >::Randomize(), and download::DownloadManager::UpdateProxiesUnlocked().

Here is the caller graph for this function:

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

Returns random double in range [0, 1]

Definition at line 60 of file prng.h.

double Prng::NextNormal ( )

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

Definition at line 71 of file prng.h.

Member Data Documentation

const uint64_t Prng::a = 6364136223846793005LLU

Definition at line 84 of file prng.h.

const uint64_t Prng::c = 1442695040888963407LLU

Definition at line 85 of file prng.h.

uint64_t Prng::state_

Definition at line 86 of file prng.h.

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