Class RandomString

java.lang.Object
org.stubit.random.RandomString

@NullMarked public class RandomString extends Object
Generates random strings.
  • Method Details

    • aStringStartingWith

      public static RandomString.Builder aStringStartingWith(String string)
      Parameters:
      string - the character the string should start with
      Returns:
      a new RandomString.Builder
    • aLatinLetter

      public static String aLatinLetter()
      Returns:
      a randomly selected letter from Alphabet.BASIC_LATIN.
    • latinLetters

      public static String latinLetters(int number)
      Parameters:
      number - the number of letters to generate
      Returns:
      a number of letters from Alphabet.BASIC_LATIN.
    • anArabicDigit

      public static String anArabicDigit()
      Returns:
      a randomly selected digit from DigitSystem.ARABIC.
    • arabicDigits

      public static @NonNull String arabicDigits(int number)
      Parameters:
      number - the number of digits to generate
      Returns:
      a number of digits from DigitSystem.ARABIC.
    • aLetterFrom

      public static String aLetterFrom(Alphabet alphabet)
      Parameters:
      alphabet - the Alphabet to select a character from
      Returns:
      a randomly selected character from the provided Alphabet.
    • lettersFrom

      public static String lettersFrom(int number, Alphabet alphabet)
      Parameters:
      number - the number of letters to generate
      alphabet - the Alphabet to select a character from
      Returns:
      a randomly selected character from the provided Alphabet.
    • aDigitFrom

      public static String aDigitFrom(DigitSystem digitSystem)
      Parameters:
      digitSystem - the DigitSystem to select a character from
      Returns:
      a randomly selected character from the provided DigitSystem.
    • digitsFrom

      public static String digitsFrom(int number, DigitSystem digitSystem)
      Parameters:
      number - the number of digits to generate
      digitSystem - the DigitSystem to select the digits from
      Returns:
      a number of randomly selected digits from the provided DigitSystem.