>Hi all
>
>I have a few formulae that need to deviate from the values attained by a simple calculator, the deviation should be a wobble. Cause if it is a one sided deviation then the values over time will be totally out of whack, I want them back to around what the calcualtor would have other wise achieved but never tally with it.
I can think of a couple of ideas:
1. Suppose your calculator normally returns the value 10, and you'd like the result to "wobble" between, say, 9 and 11. In this example the target value (lnValue) is 10, and the total wobble "range" (lnRange) is 2. The RAND() function can help:
=RAND( -1 )
lnValue = 10
lnRange = 2
lnWobble = lnValue - ( lnRange / 2 ) + ( lnRange * RAND( ) )
In the example above, the resulting values will always be between 9 and 11 (cannot go outside that range) and the results will be evenly distributed over that range if you run enough trials.
2. Maybe you'd like the "wobble" to look more like a real-world statistical deviation. IOW, most of the time the values are close to your target value (i.e. 10); values farther away are possible, but more and more unlikely as you get farther from the target. One common function for this is the "normal" (Gaussian) distribution (
http://en.wikipedia.org/wiki/Normal_distribution ). Implementing this would give a very realistic looking "wobble" but there is no built-in function in VFP for this. You'd have to program it yourself.
Regards. Al
"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov
Neither a despot, nor a doormat, be
Every app wants to be a database app when it grows up