mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
22 lines
360 B
Go
22 lines
360 B
Go
package store
|
|
|
|
import (
|
|
"math/rand"
|
|
"strconv"
|
|
)
|
|
|
|
// GenKeys randomly generate num of keys with max depth
|
|
func GenKeys(num int, depth int) []string {
|
|
keys := make([]string, num)
|
|
for i := 0; i < num; i++ {
|
|
|
|
keys[i] = "/foo/"
|
|
depth := rand.Intn(depth) + 1
|
|
|
|
for j := 0; j < depth; j++ {
|
|
keys[i] += "/" + strconv.Itoa(rand.Int())
|
|
}
|
|
}
|
|
return keys
|
|
}
|