private void PopulateBetaCache(int lastBitstring, int nextBit, double lastEvalValue, int lastLength, int maxLength, int whichEval)
{
int nextBitstring = (nextBit << lastLength) | lastBitstring;
double nextValue;
if (nextBit == 0)
nextValue = 1 - Math.Sqrt(1 - lastEvalValue);
else
nextValue = Math.Sqrt(lastEvalValue);
int currentLength = lastLength + 1;
if (currentLength == maxLength)
{
BetaCache[maxLength, whichEval][nextBitstring] = nextValue;
}
else
{
PopulateBetaCache(nextBitstring, 0, nextValue, currentLength, maxLength, whichEval);
PopulateBetaCache(nextBitstring, 1, nextValue, currentLength, maxLength, whichEval);
}
}