swapRandom
public static void swapRandom(java.lang.Object[] source,
java.lang.Object[] target)
Picks a random number between 0
and source.length
and will then re-order
the target
array with the elements of the source
array. The basic algorithm
is very simple. The order of the target
array will be the same as the order of the
source
array, but the starting point will be different.
Note, the source
and target
array should be of the same length. Also, this function has no
use if the source
array has less than 2 elements.
- Parameters:
source
- An array of objects that needs to be ordered randomly.
target
- An array with the same size as the source array into which the elements of the source will be put.