/// <summary>
        /// Returns a deep copy of the receiver.
        /// </summary>
        /// <returns></returns>
        public override Object Clone()
        {
            RandomSamplingAssistant copy = (RandomSamplingAssistant)base.Clone();

            copy.sampler = (RandomSampler)this.sampler.Clone();
            return(copy);
        }
        /// <summary>
        /// Just shows how this class can be used; samples n elements from and int[] array.
        /// </summary>
        /// <param name="n"></param>
        /// <param name="elements"></param>
        /// <returns></returns>
        public static int[] SampleArray(int n, int[] elements)
        {
            RandomSamplingAssistant assistant = new RandomSamplingAssistant(n, elements.Length, null);

            int[] sample = new int[n];
            int   j      = 0;
            int   Length = elements.Length;

            for (int i = 0; i < Length; i++)
            {
                if (assistant.SampleNextElement())
                {
                    sample[j++] = elements[i];
                }
            }
            return(sample);
        }
        /// <summary>
        /// Tests the methods of this class.
        /// To do benchmarking, comment the lines printing stuff to the console.
        /// </summary>
        /// <param name="n"></param>
        /// <param name="N"></param>
        public static void Test(long n, long N)
        {
            RandomSamplingAssistant assistant = new RandomSamplingAssistant(n, N, null);

            List <long> sample = new List <long>((int)n);
            DateTime    begin  = DateTime.Now;

            for (long i = 0; i < N; i++)
            {
                if (assistant.SampleNextElement())
                {
                    sample.Add(i);
                }
            }

            DateTime end  = DateTime.Now;
            var      diff = end.Subtract(begin).TotalMilliseconds;

            Console.WriteLine(diff);
            Console.WriteLine("sample=" + sample);
            Console.WriteLine("Good bye.\n");
        }