srandomdev() affords us the opportunity to radically improve, and at the

same time simplify, the random number selection code.


git-svn-id: http://svn0.us-east.freebsd.org/base/head/contrib/telnet@76691 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
This commit is contained in:
nsayer 2001-05-16 18:32:46 +00:00
parent 0a0c02d634
commit e7c0163dfe

View File

@ -117,6 +117,7 @@ void getseed(seed, seedsize)
char *seed; char *seed;
int seedsize; int seedsize;
{ {
#if 0
int i,f; int i,f;
int rseed; int rseed;
struct timeval tv; struct timeval tv;
@ -140,6 +141,12 @@ void getseed(seed, seedsize)
for (i = 0; i < seedsize; i++) { for (i = 0; i < seedsize; i++) {
seed[i] = (lrand48() & 0xff); seed[i] = (lrand48() & 0xff);
} }
#else
srandomdev();
for (i = 0; i < seedsize; i++) {
seed[i] = random() & 0xff;
}
#endif
} }