1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

doc: add doc for RandUniqueIntSlice

This commit is contained in:
dudaodong
2023-06-07 14:21:29 +08:00
parent 013b6457bb
commit 23a0135947
4 changed files with 58 additions and 1 deletions

View File

@@ -115,7 +115,8 @@ func UUIdV4() (string, error) {
return fmt.Sprintf("%x-%x-%x-%x-%x", uuid[0:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]), nil
}
// RandUniqueIntSlice generate a slice of random int of length n that do not repeat
// RandUniqueIntSlice generate a slice of random int of length n that do not repeat.
// Play: todo
func RandUniqueIntSlice(n, min, max int) []int {
if min > max {
return []int{}

View File

@@ -130,6 +130,7 @@ func ExampleRandUniqueIntSlice() {
if len(result) == 5 {
fmt.Println("ok")
}
fmt.Println(result)
// Output:
// ok