private void Populate(ABOResult parent, int count, ref int index, bool getFull, NamesList names, int childPercent, int siblingPercent) { if (index >= count) { return; } index++; ABOResult result = (getFull) ? new ABOFullResult() : new ABOResult(); result.SetSampleData(names, index); if (parent.Children == null) { parent.Children = new List <ABOResult>(); } parent.Children.Add(result); result.GroupSize = _random.Next(1, 25); bool makeChild = (((double)_random.Next(10000) / 10000) * 100) <= childPercent; bool makeSibling = (((double)_random.Next(10000) / 10000) * 100) <= siblingPercent; if (makeChild) { this.Populate(result, count, ref index, getFull, names, childPercent, siblingPercent); } else if (makeSibling) { this.Populate(parent, count, ref index, getFull, names, childPercent, siblingPercent); } }
private ABOResult Getter(int count, bool getFull, int childPercent, int siblingPercent) { // limit the number of results if (count > 20000) { count = 20000; } count = count - 1; var results = new List <ABOResult>(); NamesList names = new NamesList(); ABOResult result = (getFull) ? new ABOFullResult() : new ABOResult(); result.SetSampleData(names, 0); int index = 0; while (index < count) { this.Populate(result, count, ref index, getFull, names, childPercent, siblingPercent); } return(result); }