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
AlphabetThe alphabet to use for generating the string.
length
intThe 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
AlphabetThe alphabet to use for generating the string.
minLength
intThe minimum desired length of the string.
maxLength
intThe 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.