feat(Go-Tool): ArrayList添加深度复制方法以及单测类、添加Rand随机获取参数方法、RandByWeight根据权重随机获取奖励方法
This commit is contained in:
@@ -91,6 +91,11 @@ func TestJoin(t *testing.T) {
|
||||
union(mm, mm2)
|
||||
}
|
||||
|
||||
func TestEqual(t *testing.T) {
|
||||
DeepCopyIntSlice()
|
||||
DeepCopyIntSlice2()
|
||||
}
|
||||
|
||||
func intersection(mm, nn []interface{}) {
|
||||
i1 := array.Intersection(mm, nn)
|
||||
for _, row := range i1 {
|
||||
@@ -116,6 +121,18 @@ func union(mm, nn []interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func DeepCopyIntSlice() {
|
||||
src := []int{1, 2, 3, 4, 5, 6}
|
||||
src1 := array.DeepCopyIntSlice(src)
|
||||
fmt.Println(&src == &src1)
|
||||
}
|
||||
|
||||
func DeepCopyIntSlice2() {
|
||||
src := [][]int{{1, 2, 3}, {4, 5, 6}}
|
||||
src1 := array.DeepCopyIntSlice2(src)
|
||||
fmt.Println(&src == &src1)
|
||||
}
|
||||
|
||||
func init() {
|
||||
mm = make([]interface{}, 0)
|
||||
mm1 = make([]interface{}, 0)
|
||||
|
||||
Reference in New Issue
Block a user