public class NaiveShuffle<T extends java.lang.Comparable> extends java.lang.Object implements ShufflingEngine<T>
In-place algorithm to shuffle the input data. I've used the Naive prefix, simply because the algorithm works on a constant range [0 to n-1] for random-number generation, which implies same number could be chosen again, hence all numbers do not have equal probability.
ARRAY_IS_EMPTY, DATA_TYPE_NOT_SUPPORTED_YET, DECIMAL_RADIX, DELIMITER_COMMA, ELEMENT_NOT_FOUND, LIST_IS_EMPTY, OPERATION_NOT_SUPPORTED_YET
Constructor and Description |
---|
NaiveShuffle() |
Modifier and Type | Method and Description |
---|---|
void |
shuffle(T[] objects) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRandomNumberInRange
checkArray, checkIntArray, checkList
public void shuffle(T[] objects)
shuffle
in interface ShufflingEngine<T extends java.lang.Comparable>