/// <summary> /// Set all events to random values, based on their probabilities. /// </summary> /// <param name="eventState">The event state.</param> private void RandomizeEvents(EventState eventState) { // first, has this event already been randomized if (!eventState.IsCalculated) { // next, see if we can randomize the event passed int[] args = ObtainArgs(eventState.Event); if (args != null) { eventState.Randomize(args); } } // randomize children foreach (BayesianEvent childEvent in eventState.Event.Children) { RandomizeEvents(GetEventState(childEvent)); } }