Dogecoin Core
1.14.2
P2P Digital Currency
src
random.h
Go to the documentation of this file.
1
// Copyright (c) 2009-2010 Satoshi Nakamoto
2
// Copyright (c) 2009-2016 The Bitcoin Core developers
3
// Distributed under the MIT software license, see the accompanying
4
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6
#ifndef BITCOIN_RANDOM_H
7
#define BITCOIN_RANDOM_H
8
9
#include "
uint256.h
"
10
11
#include <stdint.h>
12
13
/* Seed OpenSSL PRNG with additional entropy data */
14
void
RandAddSeed
();
15
19
void
GetRandBytes
(
unsigned
char
* buf,
int
num);
20
uint64_t
GetRand
(uint64_t nMax);
21
int
GetRandInt
(
int
nMax);
22
uint256
GetRandHash
();
23
28
void
GetStrongRandBytes
(
unsigned
char
* buf,
int
num);
29
35
class
FastRandomContext
{
36
public
:
37
explicit
FastRandomContext
(
bool
fDeterministic=
false
);
38
39
uint32_t
rand32
() {
40
Rz
= 36969 * (
Rz
& 65535) + (
Rz
>> 16);
41
Rw
= 18000 * (
Rw
& 65535) + (
Rw
>> 16);
42
return
(
Rw
<< 16) +
Rz
;
43
}
44
45
uint32_t
Rz
;
46
uint32_t
Rw
;
47
};
48
49
#endif
// BITCOIN_RANDOM_H
FastRandomContext
Fast randomness source.
Definition:
random.h:35
FastRandomContext::rand32
uint32_t rand32()
Definition:
random.h:39
FastRandomContext::FastRandomContext
FastRandomContext(bool fDeterministic=false)
Definition:
random.cpp:180
FastRandomContext::Rw
uint32_t Rw
Definition:
random.h:46
FastRandomContext::Rz
uint32_t Rz
Definition:
random.h:45
uint256
256-bit opaque blob.
Definition:
uint256.h:123
GetRandInt
int GetRandInt(int nMax)
Definition:
random.cpp:168
GetRand
uint64_t GetRand(uint64_t nMax)
Definition:
random.cpp:153
GetStrongRandBytes
void GetStrongRandBytes(unsigned char *buf, int num)
Function to gather random data from multiple sources, failing whenever any of those source fail to pr...
Definition:
random.cpp:132
RandAddSeed
void RandAddSeed()
Definition:
random.cpp:46
GetRandBytes
void GetRandBytes(unsigned char *buf, int num)
Functions to gather random data via the OpenSSL PRNG.
Definition:
random.cpp:125
GetRandHash
uint256 GetRandHash()
Definition:
random.cpp:173
uint256.h
Generated on Sun May 19 2024 02:57:43 for Dogecoin Core by
1.9.1