Browse Source

Random: SystemCrypto should be disposable

pull/47/head
Christoph Ruegg 14 years ago
parent
commit
7a11a74476
  1. 7
      src/Numerics/Random/SystemCrypto.cs

7
src/Numerics/Random/SystemCrypto.cs

@ -37,7 +37,7 @@ namespace MathNet.Numerics.Random
/// <summary>
/// A random number generator based on the <see cref="System.Security.Cryptography.RandomNumberGenerator"/> class in the .NET library.
/// </summary>
public class SystemCryptoRandomNumberGenerator : AbstractRandomNumberGenerator
public class SystemCryptoRandomNumberGenerator : AbstractRandomNumberGenerator, IDisposable
{
private const double mReciprocal = 1.0 / uint.MaxValue;
private readonly RandomNumberGenerator mRandom;
@ -97,6 +97,11 @@ namespace MathNet.Numerics.Random
mRandom.GetBytes(bytes);
return BitConverter.ToUInt32(bytes, 0) * mReciprocal;
}
public void Dispose()
{
mRandom.Dispose();
}
}
}
#endif

Loading…
Cancel
Save