org.egothor.duplicity.util
Class Permutations

java.lang.Object
  extended by org.egothor.duplicity.util.Permutations

public class Permutations
extends java.lang.Object

Creates random permutations. The length of permutation is determined during the class instantiation.

Author:
Kate�ina Dufkov�

Constructor Summary
Permutations(int length)
          Creates instance with random seed.
Permutations(int length, long seed)
          Creates instance with given seed.
 
Method Summary
 int getLength()
           
 long getSeed()
           
 Permutation randomPermutation()
          Generates random permutation of integers [0 ..
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Permutations

public Permutations(int length)
Creates instance with random seed.

Parameters:
length - length of permutations to be created by this instance

Permutations

public Permutations(int length,
                    long seed)
Creates instance with given seed.

Parameters:
length - length of permutations to be created by this instance
seed - seed to be used
Method Detail

getLength

public int getLength()

getSeed

public long getSeed()

randomPermutation

public Permutation randomPermutation()
Generates random permutation of integers [0 .. getLength()-1]. The method uses Knuth algorithm.

Returns:
new random permutation object
See Also:
Wikipedia