Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/battlestar Use random(), not rand().



details:   https://anonhg.NetBSD.org/src/rev/60854190430b
branches:  trunk
changeset: 794728:60854190430b
user:      dholland <dholland%NetBSD.org@localhost>
date:      Sat Mar 22 23:33:33 2014 +0000

description:
Use random(), not rand().

diffstat:

 games/battlestar/extern.h |  4 ++--
 games/battlestar/init.c   |  6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 29287c558a80 -r 60854190430b games/battlestar/extern.h
--- a/games/battlestar/extern.h Sat Mar 22 23:31:28 2014 +0000
+++ b/games/battlestar/extern.h Sat Mar 22 23:33:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.35 2014/03/22 23:23:55 dholland Exp $ */
+/*     $NetBSD: extern.h,v 1.36 2014/03/22 23:33:33 dholland Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -45,7 +45,7 @@
 #define BITS (CHAR_BIT * sizeof (unsigned int))
 
 #define OUTSIDE                (position > 68 && position < 246 && position != 218)
-#define rnd(x)         (rand() % (x))
+#define rnd(x)         (random() % (x))
 #define max(a,b)       ((a) < (b) ? (b) : (a))
 #define testbit(array, index)  (array[index/BITS] & (1U << (index % BITS)))
 #define setbit(array, index)   (array[index/BITS] |= (1U << (index % BITS)))
diff -r 29287c558a80 -r 60854190430b games/battlestar/init.c
--- a/games/battlestar/init.c   Sat Mar 22 23:31:28 2014 +0000
+++ b/games/battlestar/init.c   Sat Mar 22 23:33:33 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: init.c,v 1.15 2005/07/01 06:04:54 jmc Exp $    */
+/*     $NetBSD: init.c,v 1.16 2014/03/22 23:33:33 dholland Exp $       */
 
 /*
  * Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)init.c     8.4 (Berkeley) 4/30/95";
 #else
-__RCSID("$NetBSD: init.c,v 1.15 2005/07/01 06:04:54 jmc Exp $");
+__RCSID("$NetBSD: init.c,v 1.16 2014/03/22 23:33:33 dholland Exp $");
 #endif
 #endif                         /* not lint */
 
@@ -54,7 +54,7 @@
        puts("First Adventure game written by His Lordship, the honorable");
        puts("Admiral D.W. Riggle\n");
        location = dayfile;
-       srand(getpid());
+       srandom(time(NULL));
        username = getutmp();
        wordinit();
        if (filename == NULL) {



Home | Main Index | Thread Index | Old Index