public static MonteCarloResult Calculate(int count, int length, float winProbability, float avgPcntWin, float avgPcntLoss) { MonteCarloResult result = new MonteCarloResult(count, length); CalculateData(result.data, winProbability, avgPcntWin, avgPcntLoss); CalculateSummary(result); return(result); }
private static void CalculateSummary(MonteCarloResult data) { int rowsCount = data.data.GetLength(0); int rowLength = data.data.GetLength(1); data.Wins = 0; for (int i = 0; i < rowsCount; i++) { data.Wins += (data.data[i, rowLength - 1] > InitialValue) ? 1 : 0; } data.Losses = rowsCount - data.Wins; data.WinsPcnt = (float)data.Wins / (float)rowsCount; data.LossesPcnt = 1.0f - data.WinsPcnt; }