Fills a buffer with random bytes from the operating system.

Synopsis

Declared in <llvm/Support/RandomNumberGenerator.h>

std::error_code
getRandomBytes(
    void* Buffer,
    size_t Size);

Description

On Windows this uses CryptGenRandom; elsewhere it reads from /dev/urandom. This is not the deterministic generator provided by RandomNumberGenerator.

Return Value

A default‐constructed error_code on success, or an error on failure.

Parameters

Name

Description

Buffer

Destination buffer to fill.

Size

Number of bytes to write into Buffer.

Created with MrDocs