public Weather() { double d1, d2 = 0.1; type = (WeatherTypes)StaticRandom.Rand(6); windSpeed = new double[500]; double rand = StaticRandom.RandDouble() * 3.0; switch (type) { case WeatherTypes.Sun: case WeatherTypes.Frost: d1 = 10.0; break; case WeatherTypes.SunWind: case WeatherTypes.FrostWind: d1 = 4.0; rand = StaticRandom.RandDouble() * 2.0 + 3.0; break; case WeatherTypes.RainWind: d1 = 4.0; rand = StaticRandom.RandDouble() * 2.0 + 3.0; d2 = 0.2; break; case WeatherTypes.Neuter: default: d1 = 7.0; break; } for (int i = 0; i < windSpeed.Length; i++) { rand = rand + (StaticRandom.RandDouble() - 0.5) / d1; if (rand < 0) { rand = 0; } int j = StaticRandom.Rand(26); if (j == 1) { windSpeed[i] = rand + d2 * rand; } else if (j == 2) { windSpeed[i] = rand - d2 * rand; } else { windSpeed[i] = rand; } } }
private List <Athlete> ListDraw(List <Athlete> atList, List <RaceStats> prSprint) { int n = atList.Count; if (atList.Count == 0) { return(null); } List <Athlete> result = new List <Athlete>(); if (Type == RaceTypes.Sprint || Type == RaceTypes.Individual) { for (int i = 0; i < n; i++) { int j = StaticRandom.Rand(atList.Count); result.Add(atList[j]); atList.RemoveAt(j); } } else if (Type == RaceTypes.Pursuit) { if (prSprint != null) { prSprint.OrderByFinish().Take(Math.Min(60, atList.Count)).ToList(). ForEach(x => result.Add(atList[x.Bib])); //prSprint.OrderBy(x => x.Finish(), new TimeSpanCompare()). // Take(Math.Min(60, atList.Count)).ToList(). // ForEach(x => athletes.Add(atList[x.Bib])); //for (int i = 0; i < Math.Min(60, atList.Count); i++) // athletes.Add(atList[h[i].Bib]); } else { return(null); } } else { result = atList.ToList(); } return(result); }