Table of Contents

Class SecureRandom

Namespace
DisCatSharp.Common
Assembly
DisCatSharp.Common.dll

Provides a cryptographically-secure pseudorandom number generator (CSPRNG) implementation compatible with Random.

public sealed class SecureRandom : Random, IDisposable
Inheritance
SecureRandom
Implements
Inherited Members
Extension Methods

Constructors

SecureRandom()

Creates a new instance of SecureRandom.

Methods

Dispose()

Disposes this SecureRandom instance and its resources.

~SecureRandom()

Finalizes this SecureRandom instance by disposing it.

GetBytes(byte[])

Fills a supplied buffer with random bytes.

GetBytes(Span<byte>)

Fills a supplied memory region with random bytes.

GetDouble()

Generates a 64-bit floating-point number between 0.0 and 1.0.

GetInt16(short, short)

Generates a signed 16-bit integer within specified range.

GetInt32(int, int)

Generates a signed 32-bit integer within specified range.

GetInt64(long, long)

Generates a signed 64-bit integer within specified range.

GetInt8(sbyte, sbyte)

Generates a signed 8-bit integer within specified range.

GetNonZeroBytes(byte[])

Fills a supplied buffer with random nonzero bytes.

GetNonZeroBytes(Span<byte>)

Fills a supplied memory region with random nonzero bytes.

GetSingle()

Generates a 32-bit floating-point number between 0.0 and 1.0.

GetUInt16(ushort, ushort)

Generates a unsigned 16-bit integer within specified range.

GetUInt32(uint, uint)

Generates a unsigned 32-bit integer within specified range.

GetUInt64(ulong, ulong)

Generates a unsigned 64-bit integer within specified range.

GetUInt8(byte, byte)

Generates a unsigned 8-bit integer within specified range.

Next()

Generates a 32-bit integer between 0 and MaxValue. Upper end exclusive.

Next(int)

Generates a 32-bit integer between 0 and maxValue. Upper end exclusive.

Next(int, int)

Generates a 32-bit integer between minValue and maxValue. Upper end exclusive.

NextBytes(byte[])

Fills specified buffer with random bytes.

NextBytes(Span<byte>)

Fills specified memory region with random bytes.

NextDouble()

Generates a 64-bit floating-point number between 0.0 and 1.0. Upper end exclusive.

Sample()

Generates a random 64-bit floating-point number between 0.0 and 1.0. Upper end exclusive.