Re: Simple optimization

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.
.



Relevant Pages

  • Re: Simple optimization
    ... disregard all integer operations. ... Maybe they taught that just for certain situations? ... That means you (or your scientists) need to ... generator but it's too slow. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Paradigmatic Change.
    ... >>> Paradigmatic Change. ... If we were taught as children that the Virgin ... > To Bill, ... You remind me of a new age slogan buzzword generator - when are you going to ...
    (sci.physics.relativity)
  • Re: Original Sin
    ... What troubles me is this ... Well, sure, the state space is finite, and we have to tweak ... number generator) a system that is a pretty good ... However this is only a simulation - a flight simulator ...
    (uk.religion.christian)
  • Re: random numbers in fortran
    ... I agree with you about seeking information from statistics ... ANY Monte Carlo simulation is better done with a statistically better ... quasi-random number generator. ... -|> Generally in practice then, could I not compensate for a short cycle by ...
    (comp.lang.fortran)
  • Re: Evolution and Observation Gap
    ... We were building a very large dynamic simulation; too large to fit on a ... section of his version of the simulation. ... truly random number generator could be devised in software, ... For most applications, a pseudo-random number ...
    (talk.origins)