Class Random


  • public class Random
    extends Object
    This class is a Stream based implementation for random string generation.
    • Constructor Detail

      • Random

        public Random()
    • Method Detail

      • stream

        public static <T> Stream<T> stream​(int limit,
                                           int length,
                                           Predicate<? super T> filter,
                                           IRandomStringGenerator<T> generator)
        generates a limited filtered stream of random strings based on an given generator
        Type Parameters:
        T - type of strings
        Parameters:
        limit - number of strings
        length - length of each random string
        filter - filter method which is applied before the stream is limited
        generator - generator
        Returns:
        limited stream
      • streamParallel

        public static <T> Stream<T> streamParallel​(int limit,
                                                   int length,
                                                   IRandomStringGenerator<T> generator)
        Type Parameters:
        T - type of strings
        Parameters:
        limit - number of strings
        length - length of each random string
        generator - generator
        Returns:
      • get

        public static String get​(int length)
      • getNumber

        public static BigInteger getNumber​(int length)
      • build

        public static org.alindner.tools.common.random.Random.RandomStream<String> build()
        Build a stream based on a given char pool
        Returns:
        stream of random strings
      • build

        public static <T> org.alindner.tools.common.random.Random.RandomStream<T> build​(IRandomStringGenerator<T> generator)
        Build a stream based on a given generator
        Type Parameters:
        T - type of result
        Parameters:
        generator - char pool
        Returns:
        stream of random strings