package main

import (
	"fmt"
	"math/rand"
	"time"
)

//查询数组是否有重复 返回重复数组位置 没有重复返回0
func RepeatInt(arr []int) int {
	m := make(map[int]int)
	for k, v := range arr {
		_, ok := m[v]
		if ok {
			return k
		} else {
			m[v] = 1
		}

	}
	return 0
}

//从 ii 个数随机取 getCount个 随机数
func IntRan(ii int, getCount int) []int {
	a := time.Now().Unix()
	rand.Seed(a)
	arr := []int{}
	for i := 0; i < getCount; i++ {
		a := rand.Intn(ii) + 1
		arr = append(arr, a)
	}
	return arr
}
func GetCj() []int {
	arr := []int{}
	for {
		arr = IntRan(99, 10)
		if RepeatInt(arr) == 0 {
			break
		}
	}
	fmt.Println(arr)
	a := []int{}
	for {
		a = IntRan(9, 3)
		//fmt.Println(a)
		if RepeatInt(a) == 0 {
			break
		}
	}
	fmt.Println(a)
	result := []int{}
	for _, v := range a {
		result = append(result, arr[v])
	}
	return result
}
func main() {
	a := GetCj()
	fmt.Println(a)
}
