Module sysrand

Group by:

This module implements interface to operation system's random number generator.

Windows using BCryptGenRandom (if available), CryptGenRandom(PROV_INTEL_SEC) (if available), RtlGenRandom.

RtlGenRandom (available from Windows XP) BCryptGenRandom (available from Windows Vista SP1) CryptGenRandom(PROV_INTEL_SEC) (only when Intel SandyBridge CPU is available).

Linux using genrandom (if available), /dev/urandom.

OpenBSD using getentropy.

NetBSD, FreeBSD, MacOS, Solaris using /dev/urandom.


proc randomBytes(pbytes: pointer; nbytes: int): int {...}{.raises: [], tags: [].}
proc randomBytes[T](bytes: var openArray[T]): int
"is greater" operator. This is the same as y < x.