github.com/alpe/etcd@v0.1.2-0.20130915230056-09f31af88aeb/store/test.go (about)

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