RandomNumberGenerator RandomNumberGenerator RandomNumberGenerator RandomNumberGenerator Class

定義

表示抽象類別 (Abstract Class),密碼編譯亂數產生器的所有實作 (Implementation) 從它衍生。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
繼承
RandomNumberGeneratorRandomNumberGeneratorRandomNumberGeneratorRandomNumberGenerator
衍生
屬性
實作

備註

密碼編譯亂數產生器建立強式密碼編譯隨機值。Cryptographic random number generators create cryptographically strong random values.

若要建立隨機的數字產生器,呼叫@System.Security.Cryptography.RandomNumberGenerator.Create方法。To create a random number generator, call the Create() method. 這是透過呼叫衍生類別的建構函式慣用@System.Security.Cryptography.RNGCryptoServiceProvider,這並不適用於所有平台。This is preferred over calling the constructor of the derived class RNGCryptoServiceProvider, which is not available on all platforms.

建構函式

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

初始化 RandomNumberGenerator 的新執行個體。Initializes a new instance of RandomNumberGenerator.

方法

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()

在衍生類別中覆寫時,將目前 RandomNumberGenerator 類別的執行個體所使用的所有資源全部釋出。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)

當在衍生類別中覆寫時,釋放 RandomNumberGenerator 所使用的 Unmanaged 資源,並選擇性釋放 Managed 資源。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)
GetInt32(Int32) GetInt32(Int32) GetInt32(Int32) GetInt32(Int32)
GetInt32(Int32, Int32) GetInt32(Int32, Int32) GetInt32(Int32, Int32) GetInt32(Int32, Int32)
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()

取得目前執行個體的 TypeGets the Type of the current instance.

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

建立目前 Object 的淺層複本 (Shallow Copy)。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)

適用於

另請參閱