The OpenD Programming Language

genRandomBlocking

Fills a buffer with random data. If not enough entropy has been gathered, it will block.

Note that on Mac OS X this method will never block.

  1. alias genRandomBlocking = mir_random_genRandomBlocking
    import mir.random.engine;
    alias genRandomBlocking = mir_random_genRandomBlocking
  2. ptrdiff_t genRandomBlocking(ubyte[] buffer)

Return Value

A non-zero integer if an error occurred.

Examples

ubyte[] buf = new ubyte[10];
genRandomBlocking(buf);

int sum;
foreach (b; buf)
    sum += b;

assert(sum > 0, "Only zero points generated");

Meta