Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Security.​Cryptography.​RNGCryptoServiceProvider

Assembly: System.Security.Cryptography

Inheritance: object → RandomNumberGenerator → RNGCryptoServiceProvider

Implements a cryptographic Random Number Generator (RNG) using the implementation provided by the cryptographic service provider (CSP). This class cannot be inherited.

Methods

protected void
Dispose​(bool disposing)
public void
GetBytes​(byte[] data)
data The array to fill with a cryptographically strong sequence of random values.
Fills an array of bytes with a cryptographically strong sequence of random values.
public void
GetBytes​(byte[] data, int offset, int count)
data The array to fill with cryptographically strong random bytes.
offset The index of the array to start the fill operation.
count The number of bytes to fill.
Fills the specified byte array with a cryptographically strong random sequence of values starting at a specified index for a specified number of bytes.
public void
GetBytes​(Span`1 data)
public void
GetNonZeroBytes​(byte[] data)
data The array to fill with a cryptographically strong sequence of random nonzero values.
Fills an array of bytes with a cryptographically strong sequence of random nonzero values.
public void
GetNonZeroBytes​(Span`1 data)
public void
Dispose​()
Inherited from RandomNumberGenerator
When overridden in a derived class, releases all resources used by the current instance of the <see cref="T:System.Security.Cryptography.RandomNumberGenerator" /> class.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object