public float DualFibonacci() { if (prandDoubler == null) { prandDoubler = new RPseudoRandF(); prandDoubler.Iterate(iDualIterationOffset); } return(RMath.SafeAdd(prandDoubler.Fibonacci(), Fibonacci())); }
public void ResetDualFibonacci(int iIterations, float offset) { if (offset < 0) { offset = 0; } iDualIterationOffset = iIterations; prandDoubler = new RPseudoRandF(); prandDoubler.fibonacciprev = offset; prandDoubler.Iterate(iDualIterationOffset); xDualFibonacciOffset = offset; }
public void ResetDualFibonacciToRPseudoRandom(int iIterations, float limit) { if (limit < 0) { limit = 0; } iDualIterationOffset = iIterations; if (prandDoubler == null) { prandDoubler = new RPseudoRandF(); } prandDoubler.ResetFibonacciToRPseudoRandom(limit); prandDoubler.Iterate(iIterations); xDualFibonacciOffset = RMath.SafeSubtract(prandDoubler.fibonacciprev, fibonacciprev); }
public RPseudoRandF() { tempprev = 0; fibonacci = 1; fibonacciprev = 0; xDualFibonacciOffset = 10; prandDoubler = null; max = float.MaxValue; int iTest = 0; while (RMath.FractionPartOf(max) == 0) { max /= 2; iTest = RMath.SafeAdd(iTest, 1); } if (iTest > 0) { max *= 2; } ResetFibonacci(); //WOULD CAUSE INFINITE RECURSION: //ResetDualFibonacci(0,xDualFibonacciOffset); //DON'T DO NOW! }