Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 May 2005 21:13:45 -0400
From:      Nicolas Blais <nb_root@videotron.ca>
To:        freebsd-questions@freebsd.org
Subject:   srandomdev() vs srandom() vs arc4random()
Message-ID:  <200505242113.54226.nb_root@videotron.ca>

next in thread | raw e-mail | index | archive | help
--nextPart2498855.Bo1s5gXD5x
Content-Type: text/plain;
  charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I'm developping a software that uses random generated numbers. Since these=
=20
numbers must be as "chaotic" as possible, I'm using srandomdev(). My proble=
m=20
is that I'm only able to compile my software on *BSD and certain distros of=
=20
Linux seem to be stripped of the call. This forces me to rely on=20
srandom(time(NULL)) for portability.

I would like to know how "random" (that is, how inprobable a pattern will=20
appear) if I use srandom(time(NULL)) instead of srandomdev().
Also, would arc4random() be any better in getting the least pattern creatio=
n.
=46inally, is there is a way to check if the call srandomdev() exists on ot=
her=20
OSes?

Thanks for your time,
Nicolas.
=2D-=20
=46reeBSD 6.0-CURRENT #2: Sun May 22 11:29:47 EDT 2005    =20
nicblais@clk01a:/usr/obj/usr/src/sys/CLK01A=20
PGP? : http://66.130.198.54:8081/security/nb_root.asc

--nextPart2498855.Bo1s5gXD5x
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQBCk9FSz38ton5LGeIRArGfAJ4omQDrqplyi6hytDGs89RZpXaUPQCcCz4N
KCbysj44eWt/Rbbvg2Z5slE=
=IYTB
-----END PGP SIGNATURE-----

--nextPart2498855.Bo1s5gXD5x--



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