All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.objectspace.jgl.algorithms.Shuffling

java.lang.Object
   |
   +----COM.objectspace.jgl.algorithms.Shuffling

public final class Shuffling
extends Object
The Shuffling class contains generic shuffling algorithms.

See Also:
ShufflingExamples

Method Index

 o randomShuffle(BidirectionalIterator, BidirectionalIterator)
Shuffle a sequence with uniform distribution by performing as many random swaps as there are elements.
 o randomShuffle(BidirectionalIterator, BidirectionalIterator, Random)
Shuffle a sequence with uniform distribution by performing as many random swaps as there are elements.
 o randomShuffle(Container)
Shuffle a random access container with uniform distribution by performing as many random swaps as there are elements.
 o randomShuffle(Container, Random)
Shuffle a random access container with uniform distribution by performing as many random swaps as there are elements.

Methods

 o randomShuffle
 public static void randomShuffle(BidirectionalIterator first,
                                  BidirectionalIterator last,
                                  Random rand)
Shuffle a sequence with uniform distribution by performing as many random swaps as there are elements. Time complexity is linear and space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the sequence.
last - An iterator positioned immediately after the last element of the sequence.
rand - An instance of java.util.Random to use when calculating which elements to swap.
Throws: IllegalArgumentException
If the iterators are incompatible or if the containers upon which the iteratore operate is not a COM.objectspace.jgl.Sequence.
 o randomShuffle
 public static void randomShuffle(BidirectionalIterator first,
                                  BidirectionalIterator last)
Shuffle a sequence with uniform distribution by performing as many random swaps as there are elements. Time complexity is linear and space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the sequence.
last - An iterator positioned immediately after the last element of the sequence.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o randomShuffle
 public static void randomShuffle(Container container,
                                  Random rand)
Shuffle a random access container with uniform distribution by performing as many random swaps as there are elements. Time complexity is linear and space complexity is constant.

Parameters:
container - The container.
rand - An instance of java.util.Random to use when calculating which elements to swap.
 o randomShuffle
 public static void randomShuffle(Container container)
Shuffle a random access container with uniform distribution by performing as many random swaps as there are elements. Time complexity is linear and space complexity is constant.

Parameters:
container - The container.

All Packages  Class Hierarchy  This Package  Previous  Next  Index