Re: Simple optimization
- From: Bob Cummings <rancho@xxxxxxxx>
- Date: Mon, 08 May 2006 20:11:27 -0500
Lucian Wischik wrote:
Bob Cummings <rancho@xxxxxxxx> wrote:
Not sure if this is the correct place or not. Anyhow in school we were taught that when trying to calculate the efficiency of an algorithm to focus on something called FLOPs or Floating Point operations and disregard all integer operations.
Maybe they taught that just for certain situations? It doesn't apply
here.
So should I have the values be between 0-100 and generate a random integer? Or have the values 0.0 to 1.0 and then generate a random double in that range.
It costs a certain amount to generate each random bit. If you only
need 7 bits (numbers 0-100) then it would be wasteful to calculate 64
bits (double) and use only the most significant ones.
But really you're approaching this from the wrong angle. For a
stochastic scientific simulation, you need a scientifically acceptable
pseudo-random generator. That means you (or your scientists) need to
review the literature, find what's considered acceptable in the field,
and use that. Later on you can post to sci.maths or some other
appropriate newsgroup and say "I am using the Mersene random number
generator but it's too slow. Are there any less costly generators
which have equivalent randomness properties?"
--
Lucian
Lucian
thanks for the reply. I actually did use a Mersene random number generator in the last simulation I developed. That simulation was implemented in C and did not cause a problem at all. I did that simulation as an intern (4 years ago) before the class in school that started this whole discussion.
.
- References:
- Simple optimization
- From: Bob Cummings
- Re: Simple optimization
- From: Lucian Wischik
- Simple optimization
- Prev by Date: Re: Adding design-time support?
- Next by Date: Re: Threading: Stopping, restarting, etc
- Previous by thread: Re: Simple optimization
- Next by thread: C# and .NET hosting with Help panel?
- Index(es):
Relevant Pages
|