srandomdev() vs srandom() vs arc4random()

Nicolas Blais nb_root at videotron.ca
Tue May 24 18:13:56 PDT 2005


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 at clk01a:/usr/obj/usr/src/sys/CLK01A 
PGP? : http://66.130.198.54:8081/security/nb_root.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20050524/26910746/attachment.bin


More information about the freebsd-questions mailing list