Beispiel #1
0
        public double Next()
        {
            int    index  = (int)(K * rand2.Next());
            double result = table[index];

            table[index] = rand1.Next();

            return(result);
        }
        public double Next()
        {
            int sum = 0;

            for (int i = 0; i < m; i++)
            {
                double a = random.Next();
                sum += (p - a > 0) ? 1 : 0;
            }

            return(sum);
        }
Beispiel #3
0
        public MacLarenRandom(RandomBSV rand1, RandomBSV rand2)
        {
            table = new double[K];

            this.rand1 = rand1;
            this.rand2 = rand2;

            for (int i = 0; i < K; i++)
            {
                table[i] = rand1.Next();
            }
        }
 public double Next()
 {
     return(Math.Ceiling(Math.Log(random.Next()) / Math.Log(1 - p)));
 }
        public double Next()
        {
            double a = random.Next();

            return((a > p) ? 0 : 1);
        }