|
Parallel Colt 0.9.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcern.colt.PersistentObject
cern.jet.random.tfloat.sampling.WeightedFloatRandomSampler
public class WeightedFloatRandomSampler
Conveniently computes a stable subsequence of elements from a given input sequence; Picks (samples) exactly one random element from successive blocks of weight input elements each. For example, if weight==2 (a block is 2 elements), and the input is 5*2=10 elements long, then picks 5 random elements from the 10 elements such that one element is randomly picked from the first block, one element from the second block, ..., one element from the last block. weight == 1.0 --> all elements are picked (sampled). weight == 10.0 --> Picks one random element from successive blocks of 10 elements each. Etc. The subsequence is guaranteed to be stable, i.e. elements never change position relative to each other.
Constructor Summary | |
---|---|
WeightedFloatRandomSampler()
Calls BlockedRandomSampler(1,null). |
|
WeightedFloatRandomSampler(int weight,
FloatRandomEngine randomGenerator)
Chooses exactly one random element from successive blocks of weight input elements each. |
Method Summary | |
---|---|
Object |
clone()
Returns a deep copy of the receiver. |
int |
getWeight()
|
boolean |
sampleNextElement()
Chooses exactly one random element from successive blocks of weight input elements each. |
void |
setWeight(int weight)
Not yet commented. |
static void |
test(int weight,
int size)
Not yet commented. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WeightedFloatRandomSampler()
public WeightedFloatRandomSampler(int weight, FloatRandomEngine randomGenerator)
weight
- the weight.randomGenerator
- a random number generator. Set this parameter to null
to use the default random number generator.Method Detail |
---|
public Object clone()
clone
in class PersistentObject
public int getWeight()
public boolean sampleNextElement()
public void setWeight(int weight)
weight
- intpublic static void test(int weight, int size)
|
Parallel Colt 0.9.4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |