Mercurial > hg > early-roguelike
diff arogue7/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 | e1cd27c5464f |
children | d3968e9cb98d |
line wrap: on
line diff
--- a/arogue7/main.c Sat Jan 28 11:45:36 2017 -0500 +++ b/arogue7/main.c Sat Jan 28 15:49:41 2017 -0500 @@ -47,8 +47,6 @@ main(int argc, char *argv[], char *envp[]) { register char *env; - int lowtime; - time_t now; #ifdef PC7300 int hardwindow; /* Do we have a hardware window? */ #endif @@ -179,10 +177,9 @@ if (argc == 2) if (!restore(argv[1], envp)) /* Note: restore will never return */ exit(1); - lowtime = (int) time(&now); dnum = (wizard && getenv("SEED") != NULL ? atoi(getenv("SEED")) : - lowtime + getpid()); + md_random_seed()); if (wizard) printf("Hello %s, welcome to dungeon #%d\n", whoami, dnum); else