Class RandomCollection<T>
java.lang.Object
com.fastasyncworldedit.core.util.collection.RandomCollection<T>
- Type Parameters:
T
- the type of values the collection holds.
- Direct Known Subclasses:
FastRandomCollection
,SimpleRandomCollection
A RandomCollection holds multiple values that can be accessed by using
next(int, int, int)
. The returned value is
determined by a given SimpleRandom
implementation.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract T
next
(int x, int y, int z) static <T> RandomCollection<T>
of
(Map<T, Double> weights, SimpleRandom random) Return a new RandomCollection.void
setRandom
(SimpleRandom random)
-
Constructor Details
-
RandomCollection
-
-
Method Details
-
of
Return a new RandomCollection. The implementation may differ depending on the given arguments but there is no need to differ.- Type Parameters:
T
- the type the collection holds.- Parameters:
weights
- the weighted map.random
- the random number generator.- Returns:
- a RandomCollection using the given weights and the RNG.
-
setRandom
-
getRandom
-
next
-