RandomNumberGenerator RandomNumberGenerator RandomNumberGenerator RandomNumberGenerator Class

Definition

Represents the abstract class from which all implementations of cryptographic random number generators derive.

public ref class RandomNumberGenerator abstract : IDisposable
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class RandomNumberGenerator : IDisposable
type RandomNumberGenerator = class
    interface IDisposable
Public MustInherit Class RandomNumberGenerator
Implements IDisposable
Inheritance
RandomNumberGeneratorRandomNumberGeneratorRandomNumberGeneratorRandomNumberGenerator
Derived
Attributes
Implements

Remarks

Cryptographic random number generators create cryptographically strong random values.

To create a random number generator, call the Create() method. This is prefered over calling the constructor of the derived class RNGCryptoServiceProvider, which is not available on all platforms.

Constructors

RandomNumberGenerator() RandomNumberGenerator() RandomNumberGenerator() RandomNumberGenerator()

Initializes a new instance of RandomNumberGenerator.

Methods

Create() Create() Create() Create()

Creates an instance of the default implementation of a cryptographic random number generator that can be used to generate random data.

Create(String) Create(String) Create(String) Create(String)

Creates an instance of the specified implementation of a cryptographic random number generator.

Dispose() Dispose() Dispose() Dispose()

When overridden in a derived class, releases all resources used by the current instance of the RandomNumberGenerator class.

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

When overridden in a derived class, releases the unmanaged resources used by the RandomNumberGenerator and optionally releases the managed resources.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
Fill(Span<Byte>) Fill(Span<Byte>) Fill(Span<Byte>) Fill(Span<Byte>)
GetBytes(Byte[]) GetBytes(Byte[]) GetBytes(Byte[]) GetBytes(Byte[])

When overridden in a derived class, fills an array of bytes with a cryptographically strong random sequence of values.

GetBytes(Byte[], Int32, Int32) GetBytes(Byte[], Int32, Int32) GetBytes(Byte[], Int32, Int32) GetBytes(Byte[], Int32, Int32)

Fills the specified byte array with a cryptographically strong random sequence of values.

GetBytes(Span<Byte>) GetBytes(Span<Byte>) GetBytes(Span<Byte>) GetBytes(Span<Byte>)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetNonZeroBytes(Byte[]) GetNonZeroBytes(Byte[]) GetNonZeroBytes(Byte[]) GetNonZeroBytes(Byte[])

When overridden in a derived class, fills an array of bytes with a cryptographically strong random sequence of nonzero values.

GetNonZeroBytes(Span<Byte>) GetNonZeroBytes(Span<Byte>) GetNonZeroBytes(Span<Byte>) GetNonZeroBytes(Span<Byte>)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to