Class RandomStringFromAlphabetGenerator

java.lang.Object
org.schabi.newpipe.extractor.utils.RandomStringFromAlphabetGenerator

public final class RandomStringFromAlphabetGenerator extends Object
Generates a random string from a predefined alphabet.
  • Method Details

    • generate

      @Nonnull public static String generate(String alphabet, int length, Random random)
      Generate a random string from an alphabet.
      Parameters:
      alphabet - the characters' alphabet to use
      length - the length of the returned string (greater than 0)
      random - Random (or better SecureRandom) used for generating the random string
      Returns:
      a random string of the requested length made of only characters from the provided alphabet