test.go 360 B

123456789101112131415161718192021
  1. package store
  2. import (
  3. "math/rand"
  4. "strconv"
  5. )
  6. // GenKeys randomly generate num of keys with max depth
  7. func GenKeys(num int, depth int) []string {
  8. keys := make([]string, num)
  9. for i := 0; i < num; i++ {
  10. keys[i] = "/foo/"
  11. depth := rand.Intn(depth) + 1
  12. for j := 0; j < depth; j++ {
  13. keys[i] += "/" + strconv.Itoa(rand.Int())
  14. }
  15. }
  16. return keys
  17. }