presto-main/src/main/java/io/prestosql/sql/planner/NodePartitioningManager.java/NodePartitioningManager/cyclingShuffledStream
class NodePartitioningManager:    private static <T> Stream<T> cyclingShuffledStream(Collection<T> collection)
    {
        List<T> list = new ArrayList<>(collection);
        Collections.shuffle(list);
        return Stream.generate(() -> list).flatMap(List::stream);
    }