/// <summary> /// Returns a sample from the distribution /// </summary> /// <param name="Random"></param> /// <param name="Alpha"></param> /// <param name="Beta"></param> /// <returns></returns> public static double Sample(Generators.Generator Random, double Alpha, double Beta) { double betaVariate = BetaDistribution.Sample(Random, Alpha, Beta); double tmp = 1.0 - betaVariate; return(IsNearZero(tmp) ? double.PositiveInfinity : betaVariate / tmp); }
/// <summary> /// Returns a sample from the distribution /// </summary> /// <param name="Random"></param> /// <param name="Alpha"></param> /// <param name="Beta"></param> /// <returns></returns> public static double Sample(Generators.Generator Random, double Alpha, double Beta) { double x = BetaDistribution.Sample(Random, Alpha / 2, Beta / 2); return((Beta * x) / (Alpha * (1 - x))); }