RandomNumberGenerator

RandomNumberGenerator

System.Security.Cryptography (mscorlib.dll)abstract class
public abstract class RandomNumberGenerator {
// Public Constructors
   public RandomNumberGenerator(  );
// Public Static Methods
   public static RandomNumberGenerator Create(  );
   public static RandomNumberGenerator Create(string rngName);
// Public Instance Methods
   public abstract void GetBytes(byte[  ] data);
   public abstract void GetNonZeroBytes(byte[  ] data);
}

The RandomNumberGenerator class is the abstract base from which random number generator implementations inherit. Implementation classes are instantiated with the Create( ) method, which accepts the name of an implementation as a String argument. An instance of the default algorithm is created if no name is specified; the system administrator can configure the default algorithm.

The GetBytes( ) method populates a System.Byte array with random values; the array to fill is the sole argument to the method. The GetNonZeroBytes( ) method populates a System.Byte array with random values, none of which will be 0.

The .NET Framework class library includes the RNGCryptoServiceProvider class, which is the default implementation.

Subclasses

RNGCryptoServiceProvider

Returned By

RSAOAEPKeyExchangeFormatter.Rng, RSAPKCS1KeyExchangeDeformatter.RNG, RSAPKCS1KeyExchangeFormatter.Rng

Passed To

RSAOAEPKeyExchangeFormatter.Rng, RSAPKCS1KeyExchangeDeformatter.RNG, RSAPKCS1KeyExchangeFormatter.Rng



    Part V: API Quick Reference