Dash Core  0.12.2.1
P2P Digital Currency
random.cpp File Reference
#include "random.h"
#include "support/cleanse.h"
#include "serialize.h"
#include "util.h"
#include "utilstrencodings.h"
#include <limits>
#include <sys/time.h>
#include <openssl/err.h>
#include <openssl/rand.h>

Go to the source code of this file.

Functions

static int64_t GetPerformanceCounter ()
 
void RandAddSeed ()
 
void RandAddSeedPerfmon ()
 
void GetRandBytes (unsigned char *buf, int num)
 
uint64_t GetRand (uint64_t nMax)
 
int GetRandInt (int nMax)
 
uint256 GetRandHash ()
 
void seed_insecure_rand (bool fDeterministic)
 

Variables

uint32_t insecure_rand_Rz = 11
 
uint32_t insecure_rand_Rw = 11
 

Function Documentation

◆ GetPerformanceCounter()

static int64_t GetPerformanceCounter ( )
inlinestatic

Definition at line 25 of file random.cpp.

Referenced by RandAddSeed().

◆ GetRand()

◆ GetRandBytes()

◆ GetRandHash()

uint256 GetRandHash ( )

Definition at line 114 of file random.cpp.

Referenced by CAddrMan::Clear(), LimitOrphanTxSize(), RelayAddress(), and SendMessages().

◆ GetRandInt()

◆ RandAddSeed()

void RandAddSeed ( )

Seed OpenSSL PRNG with additional entropy data

Definition at line 38 of file random.cpp.

Referenced by CInit::CInit(), and RandAddSeedPerfmon().

◆ RandAddSeedPerfmon()

void RandAddSeedPerfmon ( )

◆ seed_insecure_rand()

void seed_insecure_rand ( bool  fDeterministic = false)

Seed insecure_rand using the random pool.

Parameters
DeterministicUse a deterministic seed

Definition at line 123 of file random.cpp.

Referenced by AppInit2(), and ApproximateBestSubset().

Variable Documentation

◆ insecure_rand_Rw

uint32_t insecure_rand_Rw = 11

Definition at line 122 of file random.cpp.

Referenced by insecure_rand(), and seed_insecure_rand().

◆ insecure_rand_Rz

uint32_t insecure_rand_Rz = 11

MWC RNG of George Marsaglia This is intended to be fast. It has a period of 2^59.3, though the least significant 16 bits only have a period of about 2^30.1.

Returns
random value

Definition at line 121 of file random.cpp.

Referenced by insecure_rand(), and seed_insecure_rand().