Package com.iplanet.dpro.session.service
Class PermutationGenerator
- java.lang.Object
-
- com.iplanet.dpro.session.service.PermutationGenerator
-
public class PermutationGenerator extends Object
Utility class to generate uniformly distributed random permutations of integers in the range 0..size Permutation generation deterministically produces the same result if given the same seed value This class is used to implement enhanced request routing scheme as described in http://is.red.iplanet.com/failover/s1as7/IS62-SessionFailover.sxw
-
-
Constructor Summary
Constructors Constructor Description PermutationGenerator(long seed, int size)
ConstructsPermutationGenerator
PermutationGenerator(String seed, int size)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description short
itemAt(int pos)
Returns permutation element at a given position Throwsstatic void
main(String[] args)
-
-
-
Constructor Detail
-
PermutationGenerator
public PermutationGenerator(String seed, int size)
Constructor- Parameters:
seed
- seed used by RNGsize
- permutation size
-
PermutationGenerator
public PermutationGenerator(long seed, int size)
ConstructsPermutationGenerator
- Parameters:
seed
- seed used by RNGsize
- permutation size
-
-
Method Detail
-
itemAt
public short itemAt(int pos)
Returns permutation element at a given position Throws- Parameters:
pos
- permutation element position- Returns:
- permutation element value
- Throws:
IndexOutOfBoundsException
- if index is less than 0 or greater than permutation size specified in constructor
-
-