This struct provides a namespace for a suite of functions used for acquiring random numbers from the system.

Synopsis

Declared in <bdlb_randomdevice.h>

struct RandomDevice;

Type Aliases

Name

Description

size_t

Alias for bsls::Types::size_type, used for buffer sizes.

Static Member Functions

Name

Description

getRandomBytes

Read the specified numBytes from the system random number generator into the specified buffer. Returns 0 on success, non‐zero otherwise. Note that this method may block if called repeatedly or if numBytes is high.

getRandomBytesNonBlocking

Read the specified numBytes from the system non‐blocking random number generator into the specified buffer. Returns 0 on success, non‐zero otherwise. Note that the cryptographic strength of samples drawn from this pool may or may not be lower than that of those drawn from the blocking pool, and may vary by platform.

Created with MrDocs