Browse Source

Random: NextBoolean extension

pull/316/merge
Christoph Ruegg 11 years ago
parent
commit
ee8d7948eb
  1. 17
      src/Numerics/Random/RandomExtensions.cs

17
src/Numerics/Random/RandomExtensions.cs

@ -178,7 +178,7 @@ namespace MathNet.Numerics.Random
/// </summary>
/// <param name="rnd">The random number generator.</param>
/// <returns>
/// A 64-bit signed integer greater than or equal to 0, and less than <see cref="Int64.MaxValue"/>; that is,
/// A 64-bit signed integer greater than or equal to 0, and less than <see cref="Int64.MaxValue"/>; that is,
/// the range of return values includes 0 but not <see cref="Int64.MaxValue"/>.
/// </returns>
/// <seealso cref="NextFullRangeInt64"/>
@ -246,7 +246,7 @@ namespace MathNet.Numerics.Random
/// </summary>
/// <param name="rnd">The random number generator.</param>
/// <returns>
/// A decimal floating point number greater than or equal to 0.0, and less than 1.0; that is,
/// A decimal floating point number greater than or equal to 0.0, and less than 1.0; that is,
/// the range of return values includes 0.0 but not 1.0.
/// </returns>
/// <remarks>
@ -273,5 +273,18 @@ namespace MathNet.Numerics.Random
return candidate;
}
/// <summary>
/// Returns a random boolean.
/// </summary>
/// <param name="rnd">The random number generator.</param>
/// <remarks>
/// This extension is thread-safe if and only if called on an random number
/// generator provided by Math.NET Numerics or derived from the RandomSource class.
/// </remarks>
public static bool NextBoolean(this System.Random rnd)
{
return rnd.NextDouble() >= 0.5;
}
}
}

Loading…
Cancel
Save