Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Sep 2008 00:54:09 -0400
From:      Robert Huff <roberthuff@rcn.com>
To:        questions@freebsd.org
Subject:   using /dev/random
Message-ID:  <18648.30321.369520.631459@jerusalem.litteratus.org>

next in thread | raw e-mail | index | archive | help

	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.


				Robert Huff




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?18648.30321.369520.631459>