T
- the type of items to iterate over; ideally, the items are uniquepublic class GapShuffler<T> extends Object implements Iterable<T>, Serializable
Constructor and Description |
---|
GapShuffler(Collection<T> elements)
Constructor that takes any Collection of T, shuffles it with an unseeded RNG, and can then iterate infinitely
through mostly-random shuffles of the given collection.
|
GapShuffler(Collection<T> elements,
RNG rng)
Constructor that takes any Collection of T, shuffles it with the given RNG, and can then iterate infinitely
through mostly-random shuffles of the given collection.
|
Modifier and Type | Method and Description |
---|---|
T |
getNext()
Gets the next element of the infinite sequence of T this shuffles through.
|
Iterator<T> |
iterator()
Returns an infinite iterator over elements of type
T . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public GapShuffler(Collection<T> elements)
elements
- a Collection of T that will not be modifiedpublic GapShuffler(Collection<T> elements, RNG rng)
elements
- a Collection of T that will not be modifiedrng
- an RNG that can be pre-seeded; will be copied and not used directlypublic T getNext()
Copyright © 2012–2016. All rights reserved.