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:
@@ -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{}
|
||||
|
||||
@@ -130,6 +130,7 @@ func ExampleRandUniqueIntSlice() {
|
||||
if len(result) == 5 {
|
||||
fmt.Println("ok")
|
||||
}
|
||||
fmt.Println(result)
|
||||
|
||||
// Output:
|
||||
// ok
|
||||
|
||||
Reference in New Issue
Block a user