GetDoubles() public method

Return an array of random doubles with values in a specified range.
public GetDoubles ( double min, double max, int count ) : double[]
min double
max double
count int
return double[]
        /// <summary>
        /// Get the collection of values to be used as arguments
        /// </summary>
        public override IEnumerable GetData(ParameterInfo parameter)
        {
            Randomizer r = Randomizer.GetRandomizer(parameter);
            IList      values;

            switch (sampleType)
            {
            default:
            case SampleType.Raw:
                values = r.GetDoubles(count);
                break;

            case SampleType.IntRange:
                values = r.GetInts(min, max, count);
                break;

            case SampleType.DoubleRange:
                values = r.GetDoubles(dmin, dmax, count);
                break;
            }

            // Copy the random values into the data array
            // and call the base class which may need to
            // convert them to another type.
            this.data = new object[values.Count];
            for (int i = 0; i < values.Count; i++)
            {
                this.data[i] = values[i];
            }

            return(base.GetData(parameter));
        }
Exemplo n.º 2
0
        public new IEnumerable GetData(ParameterInfo parameter)
        {
            Randomizer randomizer = Randomizer.GetRandomizer(parameter);
            IList      list;

            switch (sampleType)
            {
            default:
                list = randomizer.GetDoubles(count);
                break;

            case SampleType.IntRange:
                list = randomizer.GetInts(min, max, count);
                break;

            case SampleType.DoubleRange:
                list = randomizer.GetDoubles(dmin, dmax, count);
                break;
            }
            data = new object[list.Count];
            for (int i = 0; i < list.Count; i++)
            {
                data[i] = list[i];
            }
            return(base.GetData(parameter));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get the collection of values to be used as arguments
        /// </summary>
        public override IEnumerable GetData(ParameterInfo parameter)
        {
            Randomizer r = Randomizer.GetRandomizer(parameter);

            switch (sampleType)
            {
            default:
            case SampleType.Raw:
                return(r.GetDoubles(count));

            case SampleType.IntRange:
                return(r.GetInts(min, max, count));

            case SampleType.DoubleRange:
                return(r.GetDoubles(dmin, dmax, count));
            }
        }