Class RandomStringGenerator


  • public class RandomStringGenerator
    extends Object
    The RandomStringGenerator class is a utility class that provides the capability to generate random alphanumeric strings.
    Author:
    Marcus Portmann
    • Constructor Detail

      • RandomStringGenerator

        public RandomStringGenerator()
        Constructs a new RandomStringGenerator that can be used to generate session identifiers.
      • RandomStringGenerator

        public RandomStringGenerator​(int length)
        Constructs a new RandomStringGenerator.
        Parameters:
        length - the length of the random strings that should be generated
      • RandomStringGenerator

        public RandomStringGenerator​(int length,
                                     Random random)
        Constructs a new RandomStringGenerator.
        Parameters:
        length - the length of the random strings that should be generated
        random - the random number generator
      • RandomStringGenerator

        public RandomStringGenerator​(int length,
                                     Random random,
                                     String symbols)
        Constructs a new RandomStringGenerator.
        Parameters:
        length - the length of the random strings that should be generated
        random - the random number generator
        symbols - the symbols to use when generating the random string
    • Method Detail

      • nextString

        public String nextString()
        Generate the next random alphanumeric string.
        Returns:
        the next random alphanumeric string