diff --git a/src/Numerics/Random/RandomExtensions.cs b/src/Numerics/Random/RandomExtensions.cs index 26ca1b89..0a165524 100644 --- a/src/Numerics/Random/RandomExtensions.cs +++ b/src/Numerics/Random/RandomExtensions.cs @@ -178,7 +178,7 @@ namespace MathNet.Numerics.Random /// /// The random number generator. /// - /// A 64-bit signed integer greater than or equal to 0, and less than ; that is, + /// A 64-bit signed integer greater than or equal to 0, and less than ; that is, /// the range of return values includes 0 but not . /// /// @@ -246,7 +246,7 @@ namespace MathNet.Numerics.Random /// /// The random number generator. /// - /// 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. /// /// @@ -273,5 +273,18 @@ namespace MathNet.Numerics.Random return candidate; } + + /// + /// Returns a random boolean. + /// + /// The random number generator. + /// + /// 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. + /// + public static bool NextBoolean(this System.Random rnd) + { + return rnd.NextDouble() >= 0.5; + } } }