public override SampleResult Sample()
        {
            var isSample = SystematicCounter.Next();

            if (isSample)
            {
                if (IsSelectingITrees && InsuranceSampler.Next())
                {
                    return(SampleResult.I);
                }
                else
                {
                    return(SampleResult.M);
                }
            }
            else
            {
                return(SampleResult.C);
            }
        }
        public SampleResult Sample(int kpi, out int randomNumber)
        {
            randomNumber = Rand.Next(WorkingKZ);

            var isSample = kpi > randomNumber;

            if (isSample)
            {
                if (IsSelectingITrees && InsuranceSampler.Next())
                {
                    return(SampleResult.I);
                }
                else
                {
                    return(SampleResult.M);
                }
            }
            else
            {
                return(SampleResult.C);
            }
        }
示例#3
0
        public override SampleResult Sample()
        {
            lock (this)
            {
                var frequency = Frequency;
                var block     = Block;

                var count = Count;
                var index = count % block.Length;

                var isInsuranceSample = false;
                var isSample          = block[index];
                if (!isSample && IsSelectingITrees) // if tree IS  a sample and we are selecting insureance samples
                {
                    isInsuranceSample = InsuranceSampler.Next();
                }

                // update count and generate new block if needed
                count = count + 1;
                if (count == block.Length)
                {
                    Block = GenerateBlock(frequency, Rand);
                }
                Count = count;

                if (isInsuranceSample)
                {
                    return(SampleResult.I);
                }
                else if (isSample)
                {
                    return(SampleResult.M);
                }
                else
                {
                    return(SampleResult.C);
                }
            }
        }
        public override SampleResult Sample()
        {
            var isSample = Rand.Next(Frequency) == 0;

            Count++;

            if (isSample)
            {
                if (IsSelectingITrees && InsuranceSampler.Next())
                {
                    return(SampleResult.I);
                }
                else
                {
                    return(SampleResult.M);
                }
            }
            else
            {
                return(SampleResult.C);
            }
        }