![]() |
Fabcoin Core
0.16.2
P2P Digital Currency
|
Fast randomness source. More...
#include <random.h>
Public Member Functions | |
| FastRandomContext (bool fDeterministic=false) | |
| FastRandomContext (const uint256 &seed) | |
| Initialize with explicit seed (only for testing) More... | |
| uint64_t | rand64 () |
| Generate a random 64-bit integer. More... | |
| uint64_t | randbits (int bits) |
| Generate a random (bits)-bit integer. More... | |
| uint64_t | randrange (uint64_t range) |
| Generate a random integer in the range [0..range). More... | |
| std::vector< unsigned char > | randbytes (size_t len) |
| Generate random bytes. More... | |
| uint32_t | rand32 () |
| Generate a random 32-bit integer. More... | |
| uint256 | rand256 () |
| generate a random uint256. More... | |
| bool | randbool () |
| Generate a random boolean. More... | |
Private Member Functions | |
| void | RandomSeed () |
| void | FillByteBuffer () |
| void | FillBitBuffer () |
Private Attributes | |
| bool | requires_seed |
| ChaCha20 | rng |
| unsigned char | bytebuf [64] |
| int | bytebuf_size |
| uint64_t | bitbuf |
| int | bitbuf_size |
Fast randomness source.
This is seeded once with secure random data, but is completely deterministic and insecure after that. This class is not thread-safe.
|
explicit |
Definition at line 455 of file random.cpp.
|
explicit |
Initialize with explicit seed (only for testing)
Definition at line 406 of file random.cpp.
|
inlineprivate |
|
inlineprivate |
| uint256 FastRandomContext::rand256 | ( | ) |
generate a random uint256.
Definition at line 386 of file random.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
| std::vector< unsigned char > FastRandomContext::randbytes | ( | size_t | len | ) |
Generate random bytes.
Definition at line 397 of file random.cpp.
|
private |
Definition at line 379 of file random.cpp.
|
inline |
1.8.11