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.
This commit is contained in:
parent
c194ec3dc9
commit
62047972cc
29 changed files with 123 additions and 81 deletions
|
|
@ -31,8 +31,6 @@ main(int argc, char *argv[], char *envp[])
|
|||
char *env;
|
||||
struct linked_list *item;
|
||||
struct object *obj;
|
||||
int lowtime;
|
||||
time_t now;
|
||||
|
||||
md_init(MD_STRIP_CTRL_KEYPAD);
|
||||
|
||||
|
|
@ -130,9 +128,6 @@ main(int argc, char *argv[], char *envp[])
|
|||
if (!use_savedir)
|
||||
md_normaluser();
|
||||
|
||||
time(&now);
|
||||
lowtime = (int) now;
|
||||
|
||||
env = getenv("SEED");
|
||||
|
||||
if (env)
|
||||
|
|
@ -146,7 +141,7 @@ main(int argc, char *argv[], char *envp[])
|
|||
dnum = seed;
|
||||
}
|
||||
else
|
||||
dnum = lowtime + md_getpid();
|
||||
dnum = md_random_seed();
|
||||
|
||||
if (wizard || env)
|
||||
printf("Hello %s, welcome to dungeon #%d\n", whoami, dnum);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue