Fills a buffer with random data. If not enough entropy has been gathered, it won't block. Hence the error code should be inspected.
On Linux >= 3.17 genRandomNonBlocking is guaranteed to succeed for 256 bytes and fewer.
On Mac OS X, OpenBSD, and NetBSD genRandomNonBlocking is guaranteed to succeed for any number of bytes.
length of the buffer (in bytes)
The number of bytes filled - a negative number if an error occurred
ubyte[] buf = new ubyte[10]; genRandomNonBlocking(buf); int sum; foreach (b; buf) sum += b; assert(sum > 0, "Only zero points generated");
See Implementation
Fills a buffer with random data. If not enough entropy has been gathered, it won't block. Hence the error code should be inspected.
On Linux >= 3.17 genRandomNonBlocking is guaranteed to succeed for 256 bytes and fewer.
On Mac OS X, OpenBSD, and NetBSD genRandomNonBlocking is guaranteed to succeed for any number of bytes.