## org.apache.mahout.math.jet.random.sampling
Class WeightedRandomSampler

    java.lang.Object
      org.apache.mahout.math.PersistentObject
          org.apache.mahout.math.jet.random.sampling.WeightedRandomSampler

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable

Deprecated. until unit tests are in place. Until this time, this class/interface is unsupported.

    @Deprecated
    public final class WeightedRandomSampler

extends org.apache.mahout.math.PersistentObject

See Also:
  Serialized Form

Constructor Summary
`WeightedRandomSampler()` Deprecated. Calls `BlockedRandomSampler(1,null)`.
`WeightedRandomSampler(int weight, java.util.Random randomGenerator)` Deprecated. Chooses exactly one random element from successive blocks of `weight` input elements each.

Method Summary
`java.lang.Object` `clone()` Deprecated. Returns a deep copy of the receiver.
`int` `getWeight()` Deprecated.
`boolean` `sampleNextElement()` Deprecated. Chooses exactly one random element from successive blocks of `weight` input elements each.
`void` `setWeight(int weight)` Deprecated. Not yet commented.
`static void` `test(int weight, int size)` Deprecated. Not yet commented.

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

Constructor Detail

### WeightedRandomSampler

    public WeightedRandomSampler()

  Deprecated.
  Calls `BlockedRandomSampler(1,null)`.

### WeightedRandomSampler

    public WeightedRandomSampler(int weight,
                                 java.util.Random randomGenerator)

  Deprecated.
  Chooses exactly one random element from successive blocks of `weight` input elements each. For example, if weight==2, and the input is 5*2=10 elements long, then chooses 5 random elements from the 10 elements such that one is chosen from the first block, one from the second, ..., one from the last block. weight == 1.0 --> all elements are consumed (sampled). 10.0 --> Consumes one random element from successive blocks of 10 elements each. Etc.

  Parameters:
    `weight` - the weight.
    `randomGenerator` - a random number generator. Set this parameter to `null` to use the default random number generator.

Method Detail

### clone

    public java.lang.Object clone()

  Deprecated.
  Returns a deep copy of the receiver.

  Overrides:
    `clone` in class `org.apache.mahout.math.PersistentObject`

### getWeight

    public int getWeight()

  Deprecated.

### sampleNextElement

    public boolean sampleNextElement()

  Deprecated.
  Chooses exactly one random element from successive blocks of `weight` input elements each. For example, if weight==2, and the input is 5*2=10 elements long, then chooses 5 random elements from the 10 elements such that one is chosen from the first block, one from the second, ..., one from the last block.

  Returns:
    `true` if the next element shall be sampled (picked), `false` otherwise.

### setWeight

    public void setWeight(int weight)

  Deprecated.
  Not yet commented.

  Parameters:
    `weight` - int

### test

    public static void test(int weight,
                            int size)

  Deprecated.
  Not yet commented.

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.