Mercurial > hg > early-roguelike
diff rogue5/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 | ee250e3646fd |
children |
line wrap: on
line diff
--- a/rogue5/main.c Sat Jan 28 11:45:36 2017 -0500 +++ b/rogue5/main.c Sat Jan 28 15:49:41 2017 -0500 @@ -23,7 +23,6 @@ main(int argc, char **argv) { char *env; - time_t lowtime; md_init(); @@ -77,14 +76,13 @@ parse_opts(env); if (!use_savedir && (env == NULL || whoami[0] == '\0')) strucpy(whoami, md_getusername(), strlen(md_getusername())); - lowtime = time(NULL); if (getenv("SEED") != NULL) { dnum = atoi(getenv("SEED")); noscore = 1; } else - dnum = (unsigned int) lowtime + md_getpid(); + dnum = md_random_seed(); seed = dnum; /*