using /dev/random

Robert Huff roberthuff at
Tue Sep 23 04:54:11 UTC 2008

	What is the canonical way to get data from /dev/random?
Specifically: having opened the file, how do I read the stream?
I'm currently using

  union {
    float f;
    char c[4];
  } foo;

  foo.f = 0.0;


	which doesn't seem to produce anywhere near "random bytes" as
promised by the man page.

				Robert Huff

More information about the freebsd-questions mailing list