feat(Go-Tool): ArrayList添加深度复制方法以及单测类、添加Rand随机获取参数方法、RandByWeight根据权重随机获取奖励方法

This commit is contained in:
huangzj
2020-06-30 11:47:38 +08:00
parent e43051db30
commit d1d47051d6
7 changed files with 334 additions and 1 deletions
+25
View File
@@ -0,0 +1,25 @@
/*
* @Author : huangzj
* @Time : 2020/6/29 17:15
* @Description
*/
package rand
import (
"Go-Tool/util/rand"
"fmt"
"strconv"
"testing"
)
func TestRand(t *testing.T) {
fmt.Printf(strconv.Itoa(rand.GetRandInt(100, 2000)))
for _, r := range rand.GetRandIntNoRepeat(10, 100, 200) {
fmt.Printf(strconv.Itoa(r))
}
for _, r := range rand.GetDiffNum([]int{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}, 10) {
fmt.Printf(strconv.Itoa(r))
}
}