| 程序包 | 说明 |
|---|---|
| org.dromara.hutool.core.lang.selector |
选择器相关封装,包括:
WeightRandomSelector
|
| org.dromara.hutool.core.util |
提供各种工具方法,按照归类入口为XXXUtil,如字符串工具StrUtil等
|
| 限定符和类型 | 方法和说明 |
|---|---|
WeightRandomSelector<T> |
WeightRandomSelector.add(T obj,
int weight)
增加对象
|
WeightRandomSelector<T> |
WeightRandomSelector.add(WeightObj<T> weightObj)
增加对象权重
|
WeightRandomSelector<T> |
WeightRandomSelector.clear()
清空权重表
|
static <T> WeightRandomSelector<T> |
WeightRandomSelector.of()
创建权重随机获取器
|
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> WeightRandomSelector<T> |
RandomUtil.weightRandom(Iterable<WeightObj<T>> weightObjs)
带有权重的随机生成器
|
static <T> WeightRandomSelector<T> |
RandomUtil.weightRandom(WeightObj<T>[] weightObjs)
带有权重的随机生成器
|
Copyright © 2023. All rights reserved.