## org.apache.mahout.math.stats
Class Sampler

    java.lang.Object
      org.apache.mahout.math.stats.Sampler

    public class Sampler

extends Object

Discrete distribution sampler: Samples from a given discrete distribution: you provide a source of randomness and a Vector (cardinality N) which describes a distribution over [0,N), and calls to sample() sample from 0 to N using this distribution

Constructor Summary
`Sampler(Random random)`
`Sampler(Random random, double[] sampler)`
`Sampler(Random random, Vector distribution)`

Method Summary
`int` `sample()`
`int` `sample(Vector distribution)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Sampler

    public Sampler(Random random)

### Sampler

    public Sampler(Random random,
                   double[] sampler)

### Sampler

    public Sampler(Random random,
                   Vector distribution)

Method Detail

### sample

    public int sample(Vector distribution)

### sample

    public int sample()

Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.