![]() |
BSHA3
0.17.99
P2P Blockchain, based on Bitcoin
|
Fast randomness source. More...
#include <random.h>
Public Types | |
| typedef uint64_t | result_type |
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... | |
| uint64_t | operator() () |
Static Public Member Functions | |
| static constexpr uint64_t | min () |
| static constexpr uint64_t | max () |
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.
| typedef uint64_t FastRandomContext::result_type |
|
explicit |
|
explicit |
Initialize with explicit seed (only for testing)
Definition at line 408 of file random.cpp.
|
inlineprivate |
|
inlineprivate |
|
inlinestatic |
|
inlinestatic |
|
inline |
| uint256 FastRandomContext::rand256 | ( | ) |
generate a random uint256.
Definition at line 388 of file random.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
| std::vector< unsigned char > FastRandomContext::randbytes | ( | size_t | len | ) |
Generate random bytes.
Definition at line 399 of file random.cpp.
|
private |
Definition at line 381 of file random.cpp.
|
inline |
1.8.14