Browse Source

Fix Issue #427

Added fix to DoSampleInt32WithNBits too
pull/428/head
Juri 10 years ago
parent
commit
d852f99120
  1. 6
      src/Numerics/Random/RandomSource.cs

6
src/Numerics/Random/RandomSource.cs

@ -455,6 +455,12 @@ namespace MathNet.Numerics.Random
/// </summary> /// </summary>
protected virtual int DoSampleInt32WithNBits(int bitCount) protected virtual int DoSampleInt32WithNBits(int bitCount)
{ {
// Fast case: Only 0 is allowed to be returned
// No random call is needed
if (bitCount == 0)
{
return 0;
}
var bytes = new byte[4]; var bytes = new byte[4];
DoSampleBytes(bytes); DoSampleBytes(bytes);

Loading…
Cancel
Save