private ReportTableRowList Method1(int length, IScriptReader scriptReader) { var list = new ReportTableRowList(); int cumulativeLifeTime = 0; while (length > 0) { int randomLifeTimeNumber = scriptReader.GenerateNumber(0, 100); int mappedLifeTimeValue = scriptReader.MapLifeTime(randomLifeTimeNumber); int randomDelayNumber = scriptReader.GenerateNumber(0, 100); int mappedDelayTimeValue = scriptReader.MapDelayTime(randomDelayNumber); cumulativeLifeTime += mappedLifeTimeValue; list.PushRow(new ReportTableRowClass(randomLifeTimeNumber, mappedLifeTimeValue, cumulativeLifeTime, randomDelayNumber, mappedDelayTimeValue)); length--; } return list; }
private ReportTableRowList Method2(int length, IScriptReader scriptReader) { var list = new ReportTableRowList(); int cumulativeLifeTime = 0; while (length > 0) { int randomDelayNumber = scriptReader.GenerateNumber(1, 100); int mappedDelayTimeValue = scriptReader.MapDelayTime(randomDelayNumber); int life1 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int life2 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int life3 = scriptReader.MapLifeTime(scriptReader.GenerateNumber(1, 100)); int firstFailure = new List<int> {life1, life2, life3}.Min(); cumulativeLifeTime += firstFailure; list.PushRow(new ReportTableRowClass(life1, life2, life3, firstFailure, cumulativeLifeTime, randomDelayNumber, mappedDelayTimeValue)); length--; } return list; }