trek(6)'s tournament mode is intended to have deterministic "random"
numbers based on a password.  This was broken 15 years ago when
rand() was changed to random(), but the initial srand() was forgotten.

ok?

Index: setup.c
===================================================================
RCS file: /cvs/src/games/trek/setup.c,v
retrieving revision 1.8
diff -u -p -r1.8 setup.c
--- setup.c     27 Oct 2009 23:59:27 -0000      1.8
+++ setup.c     28 Aug 2013 17:43:54 -0000
@@ -105,7 +105,7 @@ setup()
                d = 0;
                for (i = 0; Game.passwd[i]; i++)
                        d += Game.passwd[i] << i;
-               srand(d);
+               srandom(d);
        }
        Param.bases = Now.bases = ranf(6 - Game.skill) + 2;
        if (Game.skill == 6)
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to