shuffle()
Shuffle the input stream into a random order.
Implementation Notes
This implementation reads the entire stream before emitting any results making it inappropriate for infinite streams. There
are two versions of this Gatherer - one that uses the platform default RandomGenerator and one that allows the caller to
specify a RandomGenerator.
Signatures
shuffle()shuffle(RandomGenerator randomGenerator)
randomGenerator- (Optional) ARandomGeneratorto use as the source of randomness.
Examples
Randomly shuffle the input stream specifying the source of random
Stream
    .of("A", "B", "C", "D", "E", "F", "G")
    .gather(Gatherers4j.shuffle(new Random(42)))
    .toList();
    
// [ "B", "D", "F", "A", "E", "G", "C" ]
Randomly shuffle the input stream with the default source of random
Stream
    .of("A", "B", "C", "D", "E", "F", "G");
    .gather(Gatherers4j.shuffle())
    .toList();
    
// [ "F", "D", "A", "G", "B", "C", "E" ]  <-- Random!