[PATCH] rand.c updates from FreeBSD RELENG_5
Hiten Pandya
hmp at backplane.com
Wed May 12 06:17:20 PDT 2004
William M. Grim wrote:
Hi.
I know there is the random(3) function, which is much better at
randomness than rand(3); however, rand(3) is ISO C, whereas random(3) is
not, as far as I know. Plus, many students and others tend to use
rand(3) because its taught.
The FreeBSD team has already made some updates to rand.c; so, I did not
need to do much to port it to DragonFly in the form of an update that
generates some better randomness.
I have included the patch, but to see what I mean about the current
rand(3) not being great, try this code (yes, I know, the seeding could
have been done better):
>
--- rand.c.orig 2004-05-11 01:34:30.000000000 -0500
+++ rand.c 2004-05-12 05:50:54.000000000 -0500
@@ -31,15 +31,18 @@
* SUCH DAMAGE.
*
* Posix rand_r function added May 1999 by Wes Peters <wes at xxxxxxxxxxxx>.
- *
- * $FreeBSD: src/lib/libc/stdlib/rand.c,v 1.2.2.1 2001/03/05 11:33:57 obrien Exp $
- * $DragonFly: src/lib/libc/stdlib/rand.c,v 1.2 2003/06/17 04:26:46 dillon Exp $
- *
- * @(#)rand.c 8.1 (Berkeley) 6/14/93
*/
You need to put those back in, the policy in place is to
update the $FreeBSD$ (or any vendor CVS Id tag) with the
version in place from the repository. So, if I was to
update rand.c with version 1.2.2.10, I would update the Id
tag accordingly. You also need to put back the $DragonFly$
tag.
The manual pages need to be updated accordingly with the
new function(s) that are added (i.e. sranddev etc).
Cheers.
-Hiten
hmp at xxxxxxxxxxxxx
More information about the Submit
mailing list