l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
December 2: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2002 May 15 16:25

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 number question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] random number question



hi mike,

i've been writing down everything i know about random numbers with C.
thanks for the info!   i hope to have something useful in a day or so.

begin msimons@moria.simons-clan.com <msimons@moria.simons-clan.com> 
> 
>   Sometimes is very valuable to be able to have pseudo-random numbers
> which can re-generate a certain sequence of numbers: this is because if 
> your program uses "rand" and crashes sometimes, you can set the seed
> value to some constant number that you know leads to a crash then rerun
> a few times with gdb to figure out what is going wrong...
 
i was able to track down an "off by one" error in my code using this
technique a few weeks ago.  it was non-fatal, and i had no idea where
the bad numbers were coming from.  saving the seed was VERY useful.
 
>   As I said to Mark last time stuff about rand/random came up.  If
> you want lots of non-reproducible random numbers you should open
> up the /dev/urandom device and read bytes from there... from read to
> read you will get randomized stuff.  If you are doing something
> cryptographically sensitive then open /dev/random, but don't try to
> read much data from that device it will block readers until it
> has enough "collected entropy"...

i remember, but reading a file is fine for setting a seed (that's what i
do) but for generating a random number, it can be unsuitable.  a monte
carlo simulation needs between 100,000 and 100,000,000 random numbers.
reading a file for all those numbers would be prohibitive.

pete
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
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:
O'Reilly and Associates
For numerous book donations.