mirror of
https://github.com/0xAX/go-algorithms
synced 2024-11-13 13:10:30 +00:00
14 lines
164 B
Go
14 lines
164 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
|
||
|
}
|