Ejemplo n.º 1
0
        /// <summary>
        /// Creates a random <see langword="decimal"/> value using a uniform distribution algorithm.
        /// </summary>
        /// <param name="anon">The anonymous data provider to use.</param>
        /// <param name="minimum">The minimum value.</param>
        /// <param name="maximum">The maximum value.</param>
        /// <returns>A random <see langword="decimal"/> value.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception>
        public static decimal AnyDecimal(this IAnonymousData anon, decimal minimum, decimal maximum)
        {
            Argument.NotNull(anon, nameof(anon));
            Argument.InRange(maximum, minimum, decimal.MaxValue, nameof(maximum), "The maximum value must be greater than the minimum value.");

            return((decimal)anon.AnyDecimal(minimum, maximum, Distribution.Uniform));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a random negative <see langword="double"/> value.
        /// </summary>
        /// <param name="anon">The anonymous data provider to use.</param>
        /// <param name="distribution">The distribution algorithm to use.</param>
        /// <returns>A random negative <see langword="double"/> value.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception>
        public static decimal AnyNegativeDecimal(this IAnonymousData anon, Distribution distribution)
        {
            Argument.NotNull(anon, nameof(anon));

            return(anon.AnyDecimal(decimal.MinValue, 0, distribution));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a random <see langword="decimal"/> value using a uniform distribution algorithm.
        /// </summary>
        /// <param name="anon">The anonymous data provider to use.</param>
        /// <returns>A random <see langword="decimal"/> value.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception>
        public static decimal AnyDecimal(this IAnonymousData anon)
        {
            Argument.NotNull(anon, nameof(anon));

            return(anon.AnyDecimal(decimal.MinValue, decimal.MaxValue, Distribution.Uniform));
        }