template <bool Reseed>
struct Random
Defined at line 21 of file ../../zircon/kernel/lib/arch/include/lib/arch/random.h
There are two flavors of CPU random number generation:
1. reseeded occasionally as the hardware chooses
2. reseeded immediately on request
The second offers stronger randomness guarantees when it's available,
but may deplete the available random state more quickly than the first.
Public Methods
bool Supported ()
Returns true if the hardware supports the operation.
If this returns false, it's not safe to call Get()!
Defined at line 51 of file ../../zircon/kernel/lib/arch/x86/random.cc
std::optional<uint64_t> Get (std::optional<unsigned int> retries)
Fetch a random value if it can be gotten quickly. If the hardware doesn't
succeed on the first try, This does a recommended standard number of
retries by default (argument is std::nullopt), or the exact number passed.
Returns std::nullopt if no value is immediately available. Simply looping
will eventually make one available, but on a CPU not stressed with other
uses of the RNG hardware the standard retries should suffice so this
failing should be considered unusual.
Defined at line 63 of file ../../zircon/kernel/lib/arch/x86/random.cc