Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ElementsBuilder{T}"/> class.
        /// </summary>
        public ElementsBuilder(IEnumerable <T> elements)
        {
            if (elements == null)
            {
                throw new ArgumentNullException(nameof(elements));
            }

            this.elements = elements.ToArray();

            if (this.elements.Length < 1)
            {
                throw new ArgumentException(
                          "The supplied collection of elements must contain at least one element. " +
                          "This collection is expected to contain the elements from which the randomized algorithm will draw; " +
                          "if the collection is empty, there are no elements to draw.",
                          nameof(elements));
            }

            // The RandomNumericSequenceGenerator is only created for collections of minimum 2 elements
            if (this.elements.Length > 1)
            {
                this.sequence = new RandomNumericSequenceGenerator(0, this.elements.Length - 1);
            }
        }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="RandomCharSequenceGenerator"/> class.
 /// </summary>
 public RandomCharSequenceGenerator()
 {
     this.randomPrintableCharNumbers = new RandomNumericSequenceGenerator(33, 126);
 }
 /// <summary>
 /// Initializes a new instance of the
 /// <see cref="RandomBooleanSequenceGenerator"/> class.
 /// </summary>
 public RandomBooleanSequenceGenerator()
 {
     this.randomBooleanNumbers = new RandomNumericSequenceGenerator(0, 1);
 }