private string stealCompute(uint currentVal, IRNG anRNG, bool thiefCuff) { string returnStr = ""; //Lazy way of looking ahead in the RNG. Probably adds some overhead to the display function. RNGState rngState = anRNG.saveState(); uint firstPercent = currentVal % 100; uint secondPercent = anRNG.genrand() % 100; uint thirdPercent = anRNG.genrand() % 100; anRNG.loadState(rngState); if (thiefCuff) { if (firstPercent < 6) { returnStr += "Rare"; } if (secondPercent < 30) { returnStr += " + Uncommon"; } if (thirdPercent < 80) { returnStr += " + Common"; } } else { if (firstPercent < 3) { returnStr = "Rare"; } else if (secondPercent < 10) { returnStr = "Uncommon"; } else if (thirdPercent < 55) { returnStr = "Common"; } } if (returnStr == "") { returnStr = "None"; } return(returnStr.TrimStart(new char[] { ' ', '+' })); }
/// <summary> /// Loads the state of the RNG /// </summary> /// <param name="inputState">Tuple<Input mti, Input mt, Input mag01></param> public void loadState(RNGState inputState) { mti = inputState.mti; inputState.mt.CopyTo(mt, 0); position = inputState.position; }
/// <summary> /// Loads the state of the RNG /// </summary> /// <param name="inputState">Tuple<Input mti, Input mt, Input mag01></param> public void loadState(RNGState inputState) { mti = inputState.mti; inputState.mt.CopyTo(mt, 0); }