Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[VxW] how to generate a random seed without using timing functions

734 views
Skip to first unread message

ramamohankn

unread,
Feb 20, 2003, 10:54:52 AM2/20/03
to VxWorks Users Group List


Hi Saravanan,


check following links


http://sunburn.stanford.edu/~knuth/programs/rng.c


http://repast.sourceforge.net/docs/how_to/random.html#custom


http://sunburn.stanford.edu/~knuth/programs.html#rng


Hope u may get some stuff over there


Regards,


Mohan


"VxWorks Users Group List" wrote:

Hi,

When my embedded board (running vxworks) boots, i need to generate a
random seed. Currently the board doesn't have any means like CMOS for
maintaining time. Thus whenever I use gettimeofday() as seed value
for srand(), the resulting rand() number repeats most of the time.

Is there any other way to generate random seed without using any
timing functions? Or any equivalent of /dev/random?

-- mks --

--
M K Saravanan
http://www.comp.nus.edu.sg/~mksarav
_______________________________________________
VxWexplo mailing list
VxWe...@csg.lbl.gov
http://www-csg.lbl.gov/mailman/listinfo/vxwexplo

Get Your Private, Free E-mail from Indiatimes at http://email.indiatimes.com
Buy the best in Movies at http://www.videos.indiatimes.com
Bid for Air Tickets @ Re.1 on Air Sahara Flights. Just log on to http://airsahara.indiatimes.com and Bid Now !

Bill Pringlemeir

unread,
Feb 20, 2003, 3:25:12 PM2/20/03
to

>>> M K Saravanan wrote...

> When my embedded board (running vxworks) boots, i need to generate a
> random seed. Currently the board doesn't have any means like CMOS
> for maintaining time. Thus whenever I use gettimeofday() as seed
> value for srand(), the resulting rand() number repeats most of the
> time.
>
> Is there any other way to generate random seed without using any
> timing functions? Or any equivalent of /dev/random?

>>> "ramamohankn" <ramam...@indiatimes.com> wrote...

I think that both of you missed some points. First, there is nothing
wrong with a rand() function sending repeat numbers. It must be
statistically biased for it to be wrong. I guess that "MKS" has found
that this is statistically incorrect and didn't eyeball pages of data
and find several repeats.

Depending on the context, no random number generator is good enough.

"http://www.ietf.org/rfc/rfc1750.txt"

The "/dev/random" that MKS wishes on vxWorks typically capture entropy
from users via key strokes and mouse presses times. Some people also
use network traffic times to supply entropy to the "/dev/random".

There is also an algorithm by Von Neumann that can "unbias" random
data to make the distributions 50/50. I think that it is described in
the above URL.

Also, I have posted vxWorks code for a "/dev/random" like driver. It
can be found on an OpenSSL mailing list archive.

"http://www.mail-archive.com/openssl-dev%40openssl.org/msg11821.html"

I make no guarantees of its reliability or usefulness.

fwiw,
Bill Pringlemeir.


--
I can remember when the air was clean and sex was dirty. - George
Burns

0 new messages