diff rogue3/main.c @ 252:3d4252fa2ed3

Use more portable random seed generation. The new function md_random_seed() has replaced time() + getpid() and similar methods. Putting everything in mdport.c slightly reduces the warnings and workarounds.
author John "Elwin" Edwards
date Sat, 28 Jan 2017 15:49:41 -0500
parents e5a15b09ce1d
children e52a8a7ad4c5
line wrap: on
line diff
--- a/rogue3/main.c	Sat Jan 28 11:45:36 2017 -0500
+++ b/rogue3/main.c	Sat Jan 28 15:49:41 2017 -0500
@@ -31,8 +31,6 @@
     char *env;
     struct linked_list *item;
     struct object *obj;
-    int lowtime;
-    time_t now;
 
     md_init(MD_STRIP_CTRL_KEYPAD);
 
@@ -130,9 +128,6 @@
     if (!use_savedir)
       md_normaluser();
     
-    time(&now);
-    lowtime = (int) now;
-
     env = getenv("SEED");
 
     if (env)
@@ -146,7 +141,7 @@
         dnum = seed;
     }
     else
-        dnum = lowtime + md_getpid();
+        dnum = md_random_seed();
 
     if (wizard || env)
 	printf("Hello %s, welcome to dungeon #%d\n", whoami, dnum);