public static LegModel[] GenerateLegs(int legCount, int binPerLeg) { var rand = new Random(); var legs = new LegModel[legCount]; for (var legOrder = 1; legOrder <= legCount; legOrder++) { var selections = new SelectionModel[binPerLeg]; for (var bin = 1; bin <= binPerLeg; bin++) { var prob = rand.NextDouble(); selections[bin - 1] = new SelectionModel(bin, prob); } //normalised the probs var sumProbs = selections.Sum(s => s.Probability); foreach (var sel in selections) { var newProb = sel.Probability / sumProbs; sel.UpdateProbability(newProb); } var sumOfProbs = selections.Sum(s => s.Probability); Assert.That(sumOfProbs > 0.99); legs[legOrder - 1] = new LegModel(legOrder, selections); } return(legs); }