ref: bf7e8777f391caa82705a0b64709a95672d2632c
dir: /sys/src/libc/9sys/truerand.c/
#include <u.h> #include <libc.h> ulong truerand(void) { ulong x; static int randfd = -1; if(randfd < 0) randfd = open("/dev/random", OREAD|OCEXEC); if(randfd < 0) sysfatal("can't open /dev/random"); if(read(randfd, &x, sizeof(x)) != sizeof(x)) sysfatal("can't read /dev/random"); return x; }