Esempio n. 1
0
        public override double Sample()
        {
            double u = Generator.NextDouble();
            double v = Generator.NextDouble();
            double z = Functions.Sqrt(-2.0 * Functions.Log(u)) * Functions.Cos(2.0 * Constants.Pi * v);

            return(Mean + StandardDeviation * z);
        }
Esempio n. 2
0
        public override double Sample()
        {
            long   index     = Generator.Next(Aliases.Length);
            double threshold = Generator.NextDouble();

            Alias alias = Aliases[index];

            return(threshold <= alias.Threshold ? alias.Lower : alias.Upper);
        }
Esempio n. 3
0
 public override double Sample()
 {
     return(-Functions.Log(Generator.NextDouble()) / Lambda);
 }
Esempio n. 4
0
 public override double Sample()
 {
     return(MinValue + Generator.NextDouble() * (MaxValue - MinValue));
 }