Class RandomLongIterator

  • All Implemented Interfaces:
    PrimitiveLongIterator

    public final class RandomLongIterator
    extends java.lang.Object
    implements PrimitiveLongIterator
    iterates over a range of long values in random order using a https://en.wikipedia.org/wiki/Linear_congruential_generator without having to have all the numbers in memory. The iterator can be reset, but not re-sized. The iteration order does not change after resetting.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean hasNext()  
      long next()  
      void reset()
      Reset the iterator to the beginning of this iteration.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RandomLongIterator

        public RandomLongIterator​(long start,
                                  long end)
        Parameters:
        start - iteration start, inclusive
        end - iteration end, exclusive
      • RandomLongIterator

        public RandomLongIterator​(long end,
                                  java.util.Random random)
        Parameters:
        end - iteration end, exclusive
        random - random instance to provide the initial seed
      • RandomLongIterator

        public RandomLongIterator​(long start,
                                  long end,
                                  java.util.Random random)
        Parameters:
        start - iteration start, inclusive
        end - iteration end, exclusive
        random - random instance to provide the initial seed