On Monday, 23 May 2016 at 08:49:18 UTC, Mickey wrote:
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!

This getrandom is not a function, but a syscall. You should be able to use it via this syscall-d package.

https://code.dlang.org/packages/syscall-d

Also, such questions should be posted to "Learn": http://forum.dlang.org/group/learn
  • getrandom in linux Mickey via Digitalmars-d
    • Re: getrandom in linux qznc via Digitalmars-d

Reply via email to