一、首先添加代码中所用到的pom依赖如下:
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.6.1</version>
</dependency>
二、然后是生成指定个随机数其总和为百分之百的代码 如下:
/**
* 生成指定个随机数(总比例为100%,1等价于100%)
*
* @param specified 生成多少位数
* @return 数字集合
*/
private static List<Double> getNumber(@NonNull Integer specified) {
List