l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2002 Mar 15 09:55

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] random # gen seeds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] random # gen seeds

On Wed, Mar 13, 2002 at 08:05:13PM -0800, Matt Holland wrote:
> I need to generate more than one random number generator seed per second 
> within a C program (I have a program that runs about 6 times a second, 
> and I need unique seeds for each run).  time(0) only gives me a 
> resolution of 1 second... any suggestions?
> Thanks,
> Matt

Ummm, you don't really say what kind of random numbers you need, true random?
Psuedo random?  Unique?  Just different?  Any reason you couldn't just
once a minute get some bytes from /dev/random to initialize a random()
and generate 6*60 psuedorandom numbers?

Quite a bit of effort has been put into /dev/random to insure it's as
random as possible collecting entropy from as many places as possible,
protection against entropy flooding, support for adding entropy by 
cat my_collection_of_random_stuff > /dev/random etc.  Oh and it's
careful to query information that is not easily visible outside
the kernel.

But the main problem is if you read to quickly from /dev/random you
will block till the generator decides it has enough entropy to output

Bill Broadley
Mathematics/Institute of Theoretical Dynamics
UC Davis
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.