getrandom in linux

Mickey via Digitalmars-d digitalmars-d at puremagic.com
Mon May 23 01:49:18 PDT 2016


Hi,
I'd like to get some unpredictable random data from Linux' 
urandom pool. The simple way to do this is reading from 
/dev/urandom. Opening a file, however, is undesirable as it 
introduces multiple points of failure.
In C I'd use:

#include <linux/random.h>
int getrandom(void *buf, size_t buflen, unsigned int flags);

How can I call this function from D in a simple and clean way?
Thanks for your help!


More information about the Digitalmars-d mailing list