//////////////////// // Public Methods // //////////////////// /// <summary> /// Changes the base value of the index /// </summary> /// <param name="change">Degree of the change</param> /// <param name="errorMargin">Error allowed in the operation (to make it a bit more random)</param> /// <returns></returns> public STATE ChangeIndexValue(CHANGE change, int errorMargin) { // If minimizing or maximizing changes are implied, there is no place for random results if (change == CHANGE.MINIMIZE) { Value = 0f; return(STATE.MIN); } else if (change == CHANGE.MAXIMIZE) { Value = 1f; return(STATE.MAX); } if (errorMargin > 100) { errorMargin = 100; } else if (errorMargin < 0) { errorMargin = 0; } float error = 1f + (Global.Methods.GetRandomPercentage(-errorMargin, errorMargin) / 100f); Value += (indexChangeLimitValues[(int)change] * error) / 100f; return(GetIndexState()); }
/// <summary> /// Changes the base value of the index /// </summary> /// <param name="change">Degree of the change. The error margin is 20%</param> /// <returns>The index state after the operation</returns> public STATE ChangeIndexValue(CHANGE change) => ChangeIndexValue(change, ErrorMarginInAnIndexChange);