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

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

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

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

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

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

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