|
|
@ -273,5 +273,18 @@ namespace MathNet.Numerics.Random |
|
|
|
|
|
|
|
|
return candidate; |
|
|
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; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|