de.aitools.iv.mds.util
Class Randomizer

java.lang.Object
  extended by de.aitools.iv.mds.util.Randomizer

public class Randomizer
extends java.lang.Object

Author:
Anita

Constructor Summary
Randomizer()
           
 
Method Summary
static java.util.ArrayList<java.lang.Integer> randomPartialSubset(java.util.ArrayList<java.lang.Integer> subset, int amount)
          Generates a random sample of defined size of input subset and removes sampled indices from input subset.
static int[] randomSample(java.util.ArrayList<java.lang.Integer> set, int amount)
          Generates a random sample of defined size of input set.
static java.util.ArrayList<java.lang.Integer> randomSample(int elements, int amount)
          Generates a random sample of defined size from an amount of elements.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Randomizer

public Randomizer()
Method Detail

randomSample

public static int[] randomSample(java.util.ArrayList<java.lang.Integer> set,
                                 int amount)
Generates a random sample of defined size of input set.

Parameters:
set - input set to sample from
amount - size of sample to be created
Returns:
int array with indices of sampled objects

randomSample

public static java.util.ArrayList<java.lang.Integer> randomSample(int elements,
                                                                  int amount)
Generates a random sample of defined size from an amount of elements. It is assumed that indices to choose from are 0..(elements-1).

Parameters:
elements - number of elements to sample from
amount - size of sample to be created
Returns:
ArrayList with indices of sampled objects

randomPartialSubset

public static java.util.ArrayList<java.lang.Integer> randomPartialSubset(java.util.ArrayList<java.lang.Integer> subset,
                                                                         int amount)
Generates a random sample of defined size of input subset and removes sampled indices from input subset.

Parameters:
subset - ArrayList with indices to sample from
amount - size of sample to be created
Returns:
ArrayList with indices of sampled objects removed from subset