Table of Contents

Class RandomStrings

Namespace
AlgorithmsSW.String
Assembly
AlgorithmsSW.dll
public static class RandomStrings
Inheritance
RandomStrings
Inherited Members

Methods

GenerateRandomString(Alphabet, int)

Generates a random string of a specified length from the given alphabet.

[ExerciseReference(5, 1, 2)]
public static string GenerateRandomString(this Alphabet alphabet, int length)

Parameters

alphabet Alphabet

The alphabet to use for generating the string.

length int

The desired length of the string.

Returns

string

A random string of characters from the specified alphabet.

Exceptions

ArgumentNullException

Thrown when the alphabet is null.

ArgumentException

Thrown when the length is negative.

GenerateRandomString(Alphabet, int, int)

Generates a random string of a specified length from the given alphabet.

public static string GenerateRandomString(this Alphabet alphabet, int minLength, int maxLength)

Parameters

alphabet Alphabet

The alphabet to use for generating the string.

minLength int

The minimum desired length of the string.

maxLength int

The maximum desired length of the string.

Returns

string

A random string of characters from the specified alphabet.

Exceptions

ArgumentNullException

Thrown when the alphabet is null.

ArgumentException

Thrown when the minimum length is greater than the maximum length.

ArgumentException

Thrown when the minimum length is negative.

ArgumentException

Thrown when the maximum length is negative.