Table of Contents

Class RandomNumberGeneratorExt

Namespace
Yubico.YubiKey.Cryptography
Assembly
Yubico.YubiKey.dll

Extension class to extend random number functionality.

public static class RandomNumberGeneratorExt
Inheritance
object
RandomNumberGeneratorExt

Methods

Fill(RandomNumberGenerator, Span<byte>)

Fill a range with random bytes.

public static void Fill(this RandomNumberGenerator rng, Span<byte> data)

Parameters

rng RandomNumberGenerator

The System.Security.Cryptography.RandomNumberGenerator instance being extended.

data Span<byte>

A System.Span<T> to fill with random bytes.

GetByte(RandomNumberGenerator, int, int)

Get a byte with a random value.

public static byte GetByte(this RandomNumberGenerator rng, int fromInclusive, int toExclusive)

Parameters

rng RandomNumberGenerator

The System.Security.Cryptography.RandomNumberGenerator instance being extended.

fromInclusive int

The lowest value of the range.

toExclusive int

One above the highest value of the range.

Returns

byte

GetInt32(RandomNumberGenerator, int, int)

Gets a random 32-bit signed int.

public static int GetInt32(this RandomNumberGenerator rng, int fromInclusive, int toExclusive)

Parameters

rng RandomNumberGenerator

The System.Security.Cryptography.RandomNumberGenerator instance being extended.

fromInclusive int

The lowest value of the range.

toExclusive int

One above the highest value of the range.

Returns

int

Random Int32.