mirror of
https://github.com/0xAX/go-algorithms
synced 2024-11-13 13:10:30 +00:00
12 lines
178 B
Go
12 lines
178 B
Go
package utils
|
|
|
|
import "math/rand"
|
|
|
|
func RandArray(n int) []int {
|
|
arr := make([]int, n)
|
|
for i := 0; i <= n - 1; i++ {
|
|
arr[i] = rand.Intn(n)
|
|
}
|
|
return arr
|
|
}
|