From owner-freebsd-questions@FreeBSD.ORG Wed May 25 01:13:56 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DF7316A41C for ; Wed, 25 May 2005 01:13:56 +0000 (GMT) (envelope-from nb_root@videotron.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6070F43D48 for ; Wed, 25 May 2005 01:13:56 +0000 (GMT) (envelope-from nb_root@videotron.ca) Received: from clk01a ([66.130.198.54]) by VL-MO-MR010.ip.videotron.ca (iPlanet Messaging Server 5.2 HotFix 1.21 (built Sep 8 2003)) with ESMTP id <0IH000C1GU37VC@VL-MO-MR010.ip.videotron.ca> for freebsd-questions@freebsd.org; Tue, 24 May 2005 21:13:55 -0400 (EDT) Date: Tue, 24 May 2005 21:13:45 -0400 From: Nicolas Blais To: freebsd-questions@freebsd.org Message-id: <200505242113.54226.nb_root@videotron.ca> MIME-version: 1.0 Content-type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary=nextPart2498855.Bo1s5gXD5x Content-transfer-encoding: 7bit User-Agent: KMail/1.8 Subject: srandomdev() vs srandom() vs arc4random() X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 May 2005 01:13:56 -0000 --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--