I need a random number generator for a gauge. In the wiki there are two examples. Both involve, among other things, taking absolute values of absolute time. Since absolute time is always positive, I don't understand the point of that step in the code. I'm sure the code works, but I prefer to understand what I'm using so I learn something from the process. Here is one (by Tom Aguilo) of the two examples:
I don't understand why "abs" is used in either instance as I can't see how what proceeds that expression can ever be negative.
Also, is the Absolute time P variable given by the sim in decimal seconds, and if so, to how many decimal places?
Code:
<Macro Name="Rand31">
(L:INSRandFact31,number) 0 ==
if{
(P:Absolute Time,seconds) abs 10 / int (>L:INSRandFact31,number)
}
767789427 (L:INSRandFact31,number) * 4711345623 + 2000000000 % d (>L:INSRandFact31,number)
20000000000 / 1 % abs 10 *
</Macro>
I don't understand why "abs" is used in either instance as I can't see how what proceeds that expression can ever be negative.
Also, is the Absolute time P variable given by the sim in decimal seconds, and if so, to how many decimal places?




