private void IncubationEndsSevere(Human agent, IRandomProvider random) { agent.SevereToHospital = random.Chance(Parameters.PropStoH); var meanTimeToAdmission = agent.SevereToHospital ? Parameters.TimeStoH : Parameters.TimeStoC; var progressionRate = 1d / meanTimeToAdmission; agent.DaysIsolated = random.SampleDaysInState(progressionRate); }
private void PersonMovedToIcu(Human agent, IRandomProvider random) { agent.DiesInIcu = random.Chance(Parameters.PropDieInIcu); var meanTimeInIcu = agent.DiesInIcu ? Parameters.TimeCtoD : Parameters.TimeCtoR; var rateOfExit = 1d / meanTimeInIcu; agent.DaysInIntensiveCare = random.SampleDaysInState(rateOfExit); }
public Task <IDelayedMessage[]> Pull(string channel, string key = null, int?max = null) { var discovered = pullFromMemCache(channel, key, max); //// Check empty key store too, 10% of the time if (_random.Chance(10) && !string.IsNullOrEmpty(key)) { var nonSpecific = pullFromMemCache(channel, null, max); discovered = discovered.Concat(nonSpecific).ToArray(); } return(Task.FromResult(discovered)); }
public override bool InfectionOccurs(SirAgent carrierAgent, Encounter <SirAgent> encounter, IRandomProvider random) { var sirContext = (SirContext)encounter.Agent.HomeArea; var p = sirContext.ProbabilityOfInfection; if (p < 0d || p > 1d) { throw new InvalidOperationException("Probability must be in [0, 1]"); } return(random.Chance(p)); }
public override bool InfectionOccurs(Human carrierAgent, Encounter <Human> encounter, IRandomProvider randomProvider) { var p = _infectiousness(carrierAgent); return(randomProvider.Chance(p)); }