[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to make a random number



On Wed, Apr 26, 2000 at 07:44:35PM -0500, Oleg Krivosheev wrote:
> On Wed, 26 Apr 2000, John Galt wrote:
> 
> > 
> > #include <time.h>
> > #include <stdlib.h>
> > 
> > int main ()
> > {
> > 	srand (time (0));
> > /* rest of program would be here */
> > }
> > 
> > This is the way they teach it in Deitel & Deitel...
> 
> no idea who D&D are but the best way IMO 
> is to feed srand off /dev/urandom

Depends on what you want. For most thing, secure randomness isn't
nessecary, so the entropy buffers should be saved for when it is
neccesary. /dev/urandom is also a Linux phonemon, and kills portability
if used indiscrimitiely.

-- 
David Starner - dstarner98@aasaa.ofe.org

The hell that is supposedly out there could be no worse than
the hell that is sometimes seen in here.


Reply to: