SystemPrng function

[SystemPrng is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions. Instead, use BCryptGenRandom.]

The SystemPrng function retrieves a specified number of random bytes from the system random number generator.

Note  This function has no associated header file or import library. To call this function, you must create a user-defined header file.


BOOL SystemPrng(
  _Out_ unsigned char pbRandomData,
  _In_  size_t        cbRandomData


pbRandomData [out]

A pointer to a buffer that receives the retrieved bytes.

cbRandomData [in]

The number of bytes to retrieve.

Return value

Always returns TRUE.


Minimum supported client

Windows Vista with SP1 [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]


Ksecdd.sys on Windows Server 2008 and Windows Vista with SP1;
Cng.sys on Windows 7 and Windows Server 2008 R2