Subject: System clock resolution and random numbers
To: None <current-users@NetBSD.ORG>
From: Rick Byers <>
List: current-users
Date: 04/30/1997 09:45:04

I'm working on an application that needs as-random-as-possible values. 
I've been using the tv_usec from gettimeofday as the seed.  My question
is, what is the resolution of tv_usec?  Is it possible to say that it will
only ever be a certain subset of possible values?  I assume it's very
difficult to predict the exact value at any given time (because subsequent
calls return significantly different values).

Is there any better way to make a random number?  I don't like the idea of
having a 32 bit seed because that limits the possible outcomes to 2^32.
Has their been any thought into putting a random number generator in the
kernel, and are there any patches to do this?  I would think this would be
nearly perfect since it would be impossible to find the pattern unless you
had root/physical access.


Rick Byers                                      Internet Access Worldwide                                      System Administrator
Welland, Ontario, Canada                                    (905)714-1400