| OpenCBDC Transaction Processor
    | 
Generates pseudo-random numbers from a given entropy source. More...
#include <random_source.hpp>
| Public Types | |
| using | result_type = unsigned int | 
| Public Member Functions | |
| random_source (const std::string &source_file) | |
| Constructor. | |
| ~random_source ()=default | |
| random_source (const random_source &other)=delete | |
| auto | operator= (const random_source &other)=delete | 
| random_source (random_source &&other)=delete | |
| auto | operator= (random_source &&other)=delete | 
| auto | operator() () -> result_type | 
| Returns a new random integer. | |
| auto | random_hash () -> hash_t | 
| Returns a random 32-byte hash value. | |
| Static Public Member Functions | |
| static constexpr auto | min () -> result_type | 
| Returns the minimum random value this source can produce. | |
| static constexpr auto | max () -> result_type | 
| Returns the maximum random value this source can produce. | |
Generates pseudo-random numbers from a given entropy source.
Construct with the path to an entropy source (usually /dev/urandom) to seed the pseudo-random number generator. After initial setup, random_source uses SHA256 to generate further random numbers using a counter. Compatible with std::uniform_int_distribution.
Definition at line 27 of file random_source.hpp.
| using cbdc::random_source::result_type = unsigned int | 
Definition at line 29 of file random_source.hpp.
| 
 | explicit | 
Constructor.
Seeds the SHA256 engine with the entropy source.
| source_file | path to a file to use as a seed. | 
Definition at line 14 of file random_source.cpp.
| 
 | default | 
| 
 | delete | 
| 
 | delete | 
| 
 | inlinestaticconstexpr | 
Returns the maximum random value this source can produce.
Definition at line 54 of file random_source.hpp.
| 
 | inlinestaticconstexpr | 
Returns the minimum random value this source can produce.
Definition at line 48 of file random_source.hpp.
| auto cbdc::random_source::operator() | ( | ) | -> result_type | 
Returns a new random integer.
Definition at line 26 of file random_source.cpp.
| 
 | delete | 
| 
 | delete | 
| auto cbdc::random_source::random_hash | ( | ) | -> hash_t | 
Returns a random 32-byte hash value.
Can generate secure-random unique identifiers (UIDs) or private keys.
Definition at line 44 of file random_source.cpp.