Esempio n. 1
0
        public void bench_mkl_sfmt19937_bernoulli_i32()
        {
            using var generator = rng.sfmt19937(RngSeed.TakeSingle <uint>(0));
            var sampler = generator.BernoulliSampler(BernoulliSpec.Define <int>(.35));

            Benchmark(sampler);
        }
Esempio n. 2
0
        void Bernouli(double p, int count)
        {
            var sw = stopwatch(false);

            sw.Start();
            var samples = BernoulliSpec <long> .Define(p).Distribution <long>(Random).Sample().Take(count);

            var avg = samples.Average();

            sw.Stop();
        }
Esempio n. 3
0
 public BernoulliDist(IPolyrand random, BernoulliSpec <T> spec)
     : base(random, spec)
 {
 }
Esempio n. 4
0
 public static BernoulliSpec <T> Define <T>(double p)
     where T : unmanaged
 => BernoulliSpec <T> .Define(p);
Esempio n. 5
0
 /// <summary>
 /// Constructs a Bernouli distribution given a specification and random source
 /// </summary>
 /// <param name="spec">A specification that characterizes the distribution</param>
 /// <param name="random">A (uniform) random source</param>
 /// <typeparam name="T">The sample element type</typeparam>
 public static BernoulliDist <T> Distribution <T>(this BernoulliSpec <T> spec, IPolyrand random)
     where T : unmanaged
 => new BernoulliDist <T>(random, spec);