fast-replace/go-fast-replace/internal/pairs/pairs.go

31 lines
476 B
Go
Raw Normal View History

2023-12-30 21:35:09 +00:00
package pairs
import (
"fmt"
"math/rand"
)
func MakePairs() []string {
var pairs []string
for i := 1; i <= 1000; i++ {
pairs = append(pairs, makeKey(i) + "," + makeValue())
}
return pairs
}
func makeKey(i int) string {
return fmt.Sprintf("%06d", i)
}
func makeValue() string {
var letters = []rune("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
var length int = len(letters)
s := make([]rune, 6)
for i := range s {
s[i] = letters[rand.Intn(length)]
}
return string(s)
}