public class RandomWeightedSelector<T> extends Object
| Constructor and Description |
|---|
RandomWeightedSelector() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(double weight,
T result)
Add an object to the list.
|
T |
next()
Chooses randomly from the list of objects based on the weightings provided.
|
int |
size() |
public void add(double weight,
T result)
weight - any relative weight that will give a larger or smaller chance of selectionresult - the result to return, if chosenpublic T next()
public int size()
Copyright © 2005–2018 Alfresco Software. All rights reserved.