Browse Source

Random: NextBoolean extension

truncatednormal
Christoph Ruegg 11 years ago
parent
commit
ee8d7948eb
  1. 13
      src/Numerics/Random/RandomExtensions.cs

13
src/Numerics/Random/RandomExtensions.cs

@ -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;
}
} }
} }

Loading…
Cancel
Save