RW wrote:
On Tue, 23 Sep 2008 11:52:07 -0400
Lowell Gilbert <[EMAIL PROTECTED]> wrote:

Robert Huff <[EMAIL PROTECTED]> writes:

        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;

  fscanf(rand_fp,"%4c",foo.c);


        which doesn't seem to produce anywhere near "random bytes"
as promised by the man page.
Have you turned off the "seeded" variable?  You'll fall back to a
software pseudorandom sequence if you don't.

kern.random.sys.seeded is just a flag that gets set to 1 on each
reseed. IIRC it's also initialized to 1 so it doesn't actually do
anything very useful.

Except tell you that the kernel random number generator has finished seeding ;)

Kris
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to