using System.Collections.Generic;
namespace ACE.Server.Entity
{
public class Probability
{
///
/// Returns the probability of none of the events occurring
/// from a list of chances
///
public static float GetProbabilityNone(List chances)
{
var probability = 1.0f;
foreach (var chance in chances)
probability *= 1.0f - chance;
return probability;
}
///
/// Returns the probability of any of the events occurring
/// from a list of chances
///
public static float GetProbabilityAny(List chances)
{
return 1.0f - GetProbabilityNone(chances);
}
}
}