overhaul the random stuff ;-)

This commit is contained in:
tg
2004-05-24 19:06:55 +00:00
parent bcd702035d
commit 712a3cc064
11 changed files with 142 additions and 68 deletions

13
main.c
View File

@ -1,4 +1,4 @@
/* $MirBSD: main.c,v 1.6 2004/04/27 19:59:56 tg Exp $ */
/* $MirBSD: main.c,v 1.7 2004/05/24 19:06:55 tg Exp $ */
/* $OpenBSD: main.c,v 1.26 2004/01/08 05:43:14 jmc Exp $ */
/*
@ -94,9 +94,6 @@ main(int argc, char *argv[])
char **wp;
struct env env;
pid_t ppid;
#ifdef KSH
long trnd;
#endif
#ifdef MEM_DEBUG
chmem_set_defaults("ct", 1);
@ -118,9 +115,6 @@ main(int argc, char *argv[])
argc = 1;
}
kshname = *argv;
#ifdef KSH
trnd = *((long *)kshname);
#endif
ainit(&aperm); /* initialize permanent Area */
@ -262,8 +256,9 @@ main(int argc, char *argv[])
ppid = getppid();
setint(global("PPID"), (long) ppid);
#ifdef KSH
trnd ^= ((long) (time((time_t *)0) * kshpid * ppid));
setint(global("RANDOM"), prng_seed(trnd));
rnd_seed( (*((long *)kshname))
^ ((long) (time(NULL) * kshpid * ppid)) );
setint(global("RANDOM"), rnd_get());
#endif /* KSH */
/* setstr can't fail here */
setstr(global(version_param), ksh_version, KSH_RETURN_ERROR);