/// <summary> /// Creates a random <see langword="TimeSpan"/> value within the specified range 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="TimeSpan"/> value.</returns> /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="maximum"/> is less than <paramref name="minimum"/>.</exception> public static TimeSpan AnyTimeSpan(this IAnonymousData anon, TimeSpan minimum, TimeSpan maximum) { Argument.NotNull(anon, nameof(anon)); Argument.InRange(maximum, minimum, TimeSpan.MaxValue, nameof(maximum), "The maximum value must be greater than the minimum value."); return(anon.AnyTimeSpan(minimum, maximum, Distribution.Uniform)); }
/// <summary> /// Creates a random <see langword="TimeSpan"/> value using the specified distribution algorithm. /// </summary> /// <param name="anon">The anonymous data provider to use.</param> /// <param name="distribution">The distribution algorithm to use.</param> /// <returns>A random <see langword="TimeSpan"/> value.</returns> /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <c>null</c>.</exception> public static TimeSpan AnyTimeSpan(this IAnonymousData anon, Distribution distribution) { Argument.NotNull(anon, nameof(anon)); return(anon.AnyTimeSpan(TimeSpan.MinValue, TimeSpan.MaxValue, distribution)); }