de.jstacs.utils.random
Class SoftOneOfN

java.lang.Object
  extended by de.jstacs.utils.random.MultivariateRandomGenerator
      extended by de.jstacs.utils.random.SoftOneOfN

public class SoftOneOfN
extends MultivariateRandomGenerator

This random generator returns 1-epsilon for one and equal parts for the rest. The content of container MRGParams is never used in this class.

Author:
Jens Keilwagen

Constructor Summary
SoftOneOfN()
          This constructor can be used for (hard) sampling one of n.
SoftOneOfN(double epsilon)
          This constructor can be used for (soft) sampling one of n.
 
Method Summary
 void generate(double[] d, int start, int number)
           
 void generate(double[] d, int start, int number, MRGParams p)
          Generates a n-dimensional random-array as part of the array d beginning at start.
 double[] generate(int number)
           
 
Methods inherited from class de.jstacs.utils.random.MultivariateRandomGenerator
generate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SoftOneOfN

public SoftOneOfN(double epsilon)
           throws IllegalArgumentException
This constructor can be used for (soft) sampling one of n. One item will get 1-epsilon, all the others will get an equal part.

Parameters:
epsilon -
Throws:
IllegalArgumentException

SoftOneOfN

public SoftOneOfN()
This constructor can be used for (hard) sampling one of n. One item will get 1, all the others 0.

Method Detail

generate

public void generate(double[] d,
                     int start,
                     int number,
                     MRGParams p)
Description copied from class: MultivariateRandomGenerator
Generates a n-dimensional random-array as part of the array d beginning at start.

Specified by:
generate in class MultivariateRandomGenerator
Parameters:
d - the array
start - the start index for generated values
number - the dimension of the array
p - the parameter of the distribution

generate

public double[] generate(int number)

generate

public void generate(double[] d,
                     int start,
                     int number)