/// <summary> /// Creates an anonymous <see cref="bool"/> 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 cref="bool"/> value.</returns> /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <see langword="null"/>.</exception> public static bool AnyBool(this IAnonymousData anon, Distribution distribution) { Argument.NotNull(anon, nameof(anon)); return(anon.AnyDouble(0, 1, distribution) >= 0.5); }
/// <summary> /// Creates an anonymous <see cref="bool"/> value using a uniform distribution algorithm. /// </summary> /// <param name="anon">The anonymous data provider to use.</param> /// <returns>A random <see cref="bool"/> value.</returns> /// <exception cref="ArgumentNullException"><paramref name="anon"/> is <see langword="null"/>.</exception> public static bool AnyBool(this IAnonymousData anon) { Argument.NotNull(anon, nameof(anon)); return(anon.AnyBool(Distribution.Uniform)); }