Note
Please note that SecureRandom class implements the IDisposable interface. If you use a custom instance
instead of the static Instance property make sure you dispose it if it's not used anymore.
public class SecureRandom : Random,
IDisposable
Public Class SecureRandom
Inherits Random
Implements IDisposable
public ref class SecureRandom : public Random,
IDisposable
type SecureRandom =
class
inherit Random
interface IDisposable
end
SecureRandom | Initializes a new instance of the SecureRandom class. To generate cryptographically secure random numbers, a default RandomNumberGenerator will be used internally. |
SecureRandom(RandomNumberGenerator) | Initializes a new instance of the SecureRandom class. |
Instance | Gets a SecureRandom instance that can be used from any threads concurrently. |
Dispose | Disposes the current SecureRandom instance. |
Dispose(Boolean) | Releases the resources used by this SecureRandom instance. |
Next |
Returns a non-negative random 32-bit integer that is less than Int32.MaxValue.
(Overrides RandomNext) |
Next(Int32) |
Returns a non-negative random integer that is less than the specified maximum.
(Overrides RandomNext(Int32)) |
Next(Int32, Int32) |
Returns a random 32-bit integer that is within a specified range.
(Overrides RandomNext(Int32, Int32)) |
NextBytes(Byte) |
Fills the elements of a specified array of bytes with random numbers.
(Overrides RandomNextBytes(Byte)) |
NextBytes(SpanByte) |
Fills the elements of the specified buffer with random numbers.
(Overrides RandomNextBytes(SpanByte)) |
NextDouble |
Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0.
(Overrides RandomNextDouble) |
NextInt64 |
Returns a non-negative random 64-bit integer that is less than Int64.MaxValue.
(Overrides RandomNextInt64) |
NextInt64(Int64) |
Returns a non-negative random 64-bit integer that is less than the specified maximum.
(Overrides RandomNextInt64(Int64)) |
NextInt64(Int64, Int64) |
Returns a random 64-bit integer that is within a specified range.
(Overrides RandomNextInt64(Int64, Int64)) |
NextSingle |
Returns a random floating-point number that is greater than or equal to 0.0, and less than 1.0.
(Overrides RandomNextSingle) |
Sample |
Returns a random floating-point number between 0.0 and 1.0.
(Overrides RandomSample) |
Convert |
Converts an Object specified in the obj parameter to the desired targetType.
See the Examples section of the generic ConvertTTarget(Object, CultureInfo) overload for an example. (Defined by ObjectExtensions) |
ConvertTTarget |
Converts an Object specified in the obj parameter to the desired TTarget.
(Defined by ObjectExtensions) |
In |
Gets whether item is among the elements of set.
See the Examples section of the generic InT(T, T) overload for an example. (Defined by ObjectExtensions) |
NextBigInteger |
Returns a non-negative random BigInteger that is within the specified maximum.
To generate a random n-byte integer use the SampleBigInteger method instead.
(Defined by RandomExtensions) |
NextBigInteger |
Returns a random BigInteger value that is within a specified range.
To generate a random n-byte integer use the SampleBigInteger method instead.
(Defined by RandomExtensions) |
NextBoolean |
Returns a random Boolean value.
(Defined by RandomExtensions) |
NextByte |
Returns a random 8-bit unsigned integer that is less than Byte.MaxValue.
To return any Byte use the SampleByte method instead.
(Defined by RandomExtensions) |
NextByte |
Returns a random 8-bit unsigned integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextByte |
Returns a random 8-bit unsigned integer that is within a specified range.
(Defined by RandomExtensions) |
NextBytes |
Returns an Array of random bytes that has the specified length.
(Defined by RandomExtensions) |
NextChar |
Returns a random Char value that is within a specified range.
(Defined by RandomExtensions) |
NextChars |
Fills the elements of a buffer of character array with random characters using the specified allowedCharacters.
(Defined by RandomExtensions) |
NextChars |
Fills the elements of a buffer of character array with random characters using the specified allowedCharacters.
(Defined by RandomExtensions) |
NextChars |
Fills the elements of a buffer of character array with random characters using the specified strategy.
(Defined by RandomExtensions) |
NextChars |
Returns an Array of random characters that has the specified length.
(Defined by RandomExtensions) |
NextChars |
Returns an Array of random characters that has the specified length.
(Defined by RandomExtensions) |
NextChars |
Returns an Array of random characters that has the specified length.
(Defined by RandomExtensions) |
NextChars |
Returns an Array of random characters using the specified strategy that has the specified length.
(Defined by RandomExtensions) |
NextChars |
Fills the elements of a buffer with random characters using the specified allowedCharacters.
(Defined by RandomExtensions) |
NextChars |
Fills the elements of a buffer with random characters using the specified strategy.
(Defined by RandomExtensions) |
NextDate |
Returns a random DateTime that is between the specified range and has only date component.
(Defined by RandomExtensions) |
NextDateOnly |
Returns a random DateOnly that is between the specified range.
(Defined by RandomExtensions) |
NextDateTime |
Returns a random DateTime that is between the specified range.
(Defined by RandomExtensions) |
NextDateTimeOffset |
Returns a random DateTimeOffset that is between the specified range.
(Defined by RandomExtensions) |
NextDecimal |
Returns a random Decimal value that is greater than or equal to 0.0 and less than 1.0.
(Defined by RandomExtensions) |
NextDecimal |
Returns a non-negative random Decimal value that is less than or equal to the specified maxValue.
(Defined by RandomExtensions) |
NextDecimal |
Returns a random Decimal value that is within a specified range.
(Defined by RandomExtensions) |
NextDouble |
Returns a non-negative random Double value that is less than or equal to the specified maxValue.
(Defined by RandomExtensions) |
NextDouble |
Returns a random Double value that is within a specified range.
(Defined by RandomExtensions) |
NextEnumTEnum |
Returns a random TEnum value.
(Defined by RandomExtensions) |
NextGuid |
Returns a random RFC 4122 compliant Guid value generated by using the specified Random instance.
(Defined by RandomExtensions) |
NextHalf |
Returns a random Half value that is greater than or equal to 0.0 and less than 1.0.
(Defined by RandomExtensions) |
NextHalf |
Returns a non-negative random Half value that is less than or equal to the specified maxValue.
(Defined by RandomExtensions) |
NextHalf |
Returns a random Half value that is within a specified range.
(Defined by RandomExtensions) |
NextInt128 |
Returns a non-negative random 128-bit signed integer that is less than Int128.MaxValue.
To return any Int128 use the SampleInt128 method instead.
(Defined by RandomExtensions) |
NextInt128 |
Returns a non-negative random 128-bit signed integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextInt128 |
Returns a random Int128 value that is within a specified range.
(Defined by RandomExtensions) |
NextInt16 |
Returns a non-negative random 16-bit signed integer that is less than Int16.MaxValue.
To return any Int16 use the SampleInt16 method instead.
(Defined by RandomExtensions) |
NextInt16 |
Returns a non-negative random 16-bit signed integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextInt16 |
Returns a random 16-bit signed integer that is within a specified range.
(Defined by RandomExtensions) |
NextInt32 |
Returns a non-negative random 32-bit signed integer that is less than Int32.MaxValue.
To return any Int32 use the SampleInt32 method instead.
(Defined by RandomExtensions) |
NextInt32 |
Returns a non-negative random 32-bit signed integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextInt32 |
Returns a random 32-bit signed integer that is within a specified range.
(Defined by RandomExtensions) |
NextInt64 |
Returns a non-negative random 64-bit signed integer that is less than Int64.MaxValue.
To return any Int64 use the SampleInt64 method instead.
(Defined by RandomExtensions) |
NextInt64 |
Returns a non-negative random 64-bit signed integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextInt64 |
Returns a random Int64 value that is within a specified range.
(Defined by RandomExtensions) |
NextObject |
Returns a random object of the specified type or
if type cannot be instantiated with the provided settings.
(Defined by RandomExtensions) |
NextObjectT |
Returns a random object of type T or the default value of T
if T cannot be instantiated with the provided settings.
(Defined by RandomExtensions) |
NextRune |
Returns a random Rune (Unicode character).
(Defined by RandomExtensions) |
NextRune |
Returns a random Rune (Unicode character) that is within the specified category.
(Defined by RandomExtensions) |
NextRune |
Returns a random Rune (Unicode character) that is within a specified range.
(Defined by RandomExtensions) |
NextSByte |
Returns a non-negative random 8-bit signed integer that is less than SByte.MaxValue.
To return any SByte use the SampleSByte method instead.
(Defined by RandomExtensions) |
NextSByte |
Returns a non-negative random 8-bit signed integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextSByte |
Returns a random 8-bit signed integer that is within a specified range.
(Defined by RandomExtensions) |
NextSingle |
Returns a random Single value that is greater than or equal to 0.0 and less than 1.0.
(Defined by RandomExtensions) |
NextSingle |
Returns a non-negative random Single value that is less than or equal to the specified maxValue.
(Defined by RandomExtensions) |
NextSingle |
Returns a random Single value that is within a specified range.
(Defined by RandomExtensions) |
NextString |
Returns a random String using the specified strategy that has the length between 4 and 10 inclusive.
(Defined by RandomExtensions) |
NextString |
Returns a random String of the specified length using the specified strategy that has the length between the specified range.
(Defined by RandomExtensions) |
NextString |
Returns a random String that has the length between the specified range and consists of the specified allowedCharacters.
(Defined by RandomExtensions) |
NextString |
Returns a random String that has the length between the specified range and consists of the specified allowedCharacters.
(Defined by RandomExtensions) |
NextString |
Returns a random String that has the length between the specified range and consists of the specified allowedCharacters.
(Defined by RandomExtensions) |
NextString |
Returns a random String using the specified strategy that has the length between the specified range.
(Defined by RandomExtensions) |
NextTimeOnly |
Returns a random TimeOnly that is between the specified range.
(Defined by RandomExtensions) |
NextTimeSpan |
Returns a random TimeSpan that is between the specified range.
(Defined by RandomExtensions) |
NextUInt128 |
Returns a random 128-bit unsigned integer that is less than UInt128.MaxValue.
To return any UInt128 use the SampleUInt128 method instead.
(Defined by RandomExtensions) |
NextUInt128 |
Returns a random 128-bit unsigned integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextUInt128 |
Returns a random 128-bit unsigned integer that is within a specified range.
(Defined by RandomExtensions) |
NextUInt16 |
Returns a random 16-bit unsigned integer that is less than UInt16.MaxValue.
To return any UInt16 use the SampleUInt16 method instead.
(Defined by RandomExtensions) |
NextUInt16 |
Returns a random 16-bit unsigned integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextUInt16 |
Returns a random 16-bit unsigned integer that is within a specified range.
(Defined by RandomExtensions) |
NextUInt32 |
Returns a random 32-bit unsigned integer that is less than UInt32.MaxValue.
To return any UInt32 use the SampleUInt32 method instead.
(Defined by RandomExtensions) |
NextUInt32 |
Returns a random 32-bit unsigned integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextUInt32 |
Returns a random 32-bit unsigned integer that is within a specified range.
(Defined by RandomExtensions) |
NextUInt64 |
Returns a random 64-bit unsigned integer that is less than UInt64.MaxValue.
To return any UInt64 use the SampleUInt64 method instead.
(Defined by RandomExtensions) |
NextUInt64 |
Returns a random 64-bit unsigned integer that is within the specified maximum.
(Defined by RandomExtensions) |
NextUInt64 |
Returns a random 64-bit unsigned integer that is within a specified range.
(Defined by RandomExtensions) |
SampleBigInteger |
Returns a random BigInteger that represents an integer of byteSize bytes.
(Defined by RandomExtensions) |
SampleByte |
Returns a random Byte that can have any value.
(Defined by RandomExtensions) |
SampleInt128 |
Returns a random Int128 that can have any value.
(Defined by RandomExtensions) |
SampleInt16 |
Returns a random Int16 that can have any value.
(Defined by RandomExtensions) |
SampleInt32 |
Returns a random Int32 that can have any value.
(Defined by RandomExtensions) |
SampleInt64 |
Returns a random Int64 that can have any value.
(Defined by RandomExtensions) |
SampleSByte |
Returns a random SByte that can have any value.
(Defined by RandomExtensions) |
SampleUInt128 |
Returns a random UInt128 that can have any value.
(Defined by RandomExtensions) |
SampleUInt16 |
Returns a random UInt16 that can have any value.
(Defined by RandomExtensions) |
SampleUInt32 |
Returns a random UInt32 that can have any value.
(Defined by RandomExtensions) |
SampleUInt64 |
Returns a random UInt64 that can have any value.
(Defined by RandomExtensions) |
TryConvert |
Tries to convert an Object specified in the obj parameter to the desired targetType.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. (Defined by ObjectExtensions) |
TryConvert |
Tries to convert an Object specified in the obj parameter to the desired targetType.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. (Defined by ObjectExtensions) |
TryConvertTTarget |
Tries to convert an Object specified in the obj parameter to the desired TTarget.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. (Defined by ObjectExtensions) |
TryConvertTTarget |
Tries to convert an Object specified in the obj parameter to the desired TTarget.
See the Examples section of the ConvertTTarget(Object, CultureInfo) method for a related example. (Defined by ObjectExtensions) |