diff srogue/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 b922f66acf4d
children d3968e9cb98d
line wrap: on
line diff
--- a/srogue/main.c	Sat Jan 28 11:45:36 2017 -0500
+++ b/srogue/main.c	Sat Jan 28 15:49:41 2017 -0500
@@ -48,8 +48,6 @@
 	register struct object *obj;
 	char alldone, wpt;
 	char *getpass(), *xcrypt(), *strrchr();
-	int lowtime;
-	time_t now;
 	char *homedir = roguehome();
 
 	md_init();
@@ -102,8 +100,6 @@
 		}
 	}
 #endif
-	time(&now);
-	lowtime = (int) now;
 
 #ifdef SAVEDIR
 	if (argc >= 3 && !strcmp(argv[1], "-n")) {
@@ -169,7 +165,7 @@
 	/* START NEW GAME */
 
 	dnum = (wizard && getenv("SEED") != NULL ?
-		atoi(getenv("SEED")) : lowtime + md_getpid());
+		atoi(getenv("SEED")) : md_random_seed());
 
 	if(wizard)
 		printf("Hello %s, welcome to dungeon #%d\n", whoami, dnum);