GetRandom functionv0.1.0

Source
Fills length bytes of buffer with unpredictable bytes.
pub func GetRandom(
    buffer: *var opaque,
    length: uint
) -> bool

buffer is borrowed and written; length is read by value. Returns true when the whole buffer was filled, and false when the provider refused — there is no partial success to handle, unlike every Unix source. Runs in time proportional to length and allocates nothing. buffer must be writable for length bytes. length is passed as a 32-bit count, so a request above four gigabytes is refused rather than truncated.

Parameters

NameTypeDescription
buffer*var opaquereceives the bytes
lengthuinthow many bytes to fill

Returns: whether the whole buffer was filled; there is no partial success

BCRYPT_USE_SYSTEM_PREFERRED_RNG

pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: uint32 = 0x00000002;

BCRYPT_USE_SYSTEM_PREFERRED_RNG: draw from the system's preferred generator rather than a named algorithm. Passed with a null algorithm handle, which is what makes this a one-call interface: nothing has to be opened, configured, or closed.

Source

STATUS_SUCCESS

pub const STATUS_SUCCESS: int32 = 0;

STATUS_SUCCESS: the status an NtStatus-reporting call gives when it worked.

Source