Package org.neo4j.graphalgo.core.utils
Class RandomLongIterator
- java.lang.Object
-
- org.neo4j.graphalgo.core.utils.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.
-
-
Constructor Summary
Constructors Constructor Description RandomLongIterator(long start, long end)
RandomLongIterator(long start, long end, java.util.Random random)
RandomLongIterator(long end, java.util.Random random)
-
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.
-
-
-
Constructor Detail
-
RandomLongIterator
public RandomLongIterator(long start, long end)
- Parameters:
start
- iteration start, inclusiveend
- iteration end, exclusive
-
RandomLongIterator
public RandomLongIterator(long end, java.util.Random random)
- Parameters:
end
- iteration end, exclusiverandom
- random instance to provide the initial seed
-
RandomLongIterator
public RandomLongIterator(long start, long end, java.util.Random random)
- Parameters:
start
- iteration start, inclusiveend
- iteration end, exclusiverandom
- random instance to provide the initial seed
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacePrimitiveLongIterator
-
next
public long next()
- Specified by:
next
in interfacePrimitiveLongIterator
-
reset
public void reset()
Reset the iterator to the beginning of this iteration.
-
-