Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.utils.random
Class SoftOneOfN

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

    public class SoftOneOfN

extends MultivariateRandomGenerator

This random generator returns `1-epsilon` for one and equal parts for the rest of a random vector. 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)` Generates an array of length `number` as part of the array `d` beginning at index `start` with one entry getting the value `1-epsilon` and all the others equal parts of `epsilon`.
`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)` Generates an array of length `number` with one entry getting the value `1-epsilon` and all the others equal parts of `epsilon`.

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` - the value that should be subtracted from 1 for one item
  Throws:
    `IllegalArgumentException` - if the value of `epsilon` is not in [0,1]

### 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 random array
    `p` - the parameter of the underlying distribution

### generate

    public double[] generate(int number)

  Generates an array of length `number` with one entry getting the value `1-epsilon` and all the others equal parts of `epsilon`.

  Parameters:
    `number` - the length of the generated array
  Returns:
    array of length `number` with one entry getting the value `1-epsilon` and all the others equal parts of `epsilon`
  See Also:
    `generate(double[], int, int)`

### generate

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

  Generates an array of length `number` as part of the array `d` beginning at index `start` with one entry getting the value `1-epsilon` and all the others equal parts of `epsilon`.

  Parameters:
    `d` - the array
    `start` - the start index for generated values
    `number` - the dimension of the generated array

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD