Class WeightRandom<T>
java.lang.Object
com.sure.tool.lang.WeightRandom<T>
权重随机:按权重概率随机取一个对象,零依赖。
权重须为正数;总权重决定各元素命中概率 = 元素权重 / 总权重。
- Since:
- 0.2.0
- Author:
- suretool
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
WeightRandom
public WeightRandom()构造(使用默认随机源)。 -
WeightRandom
-
-
Method Details
-
add
-
clear
public void clear()清空。 -
size
public int size()当前项数量。- Returns:
- 数量
-
next
-
items
-