-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
55 lines (42 loc) · 844 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package main
import (
"fmt"
"math/rand"
"strings"
"github.com/tjarratt/babble"
)
func main() {
var STACK_LENGTH = 10
babbler := babble.NewBabbler()
babbler.Count = 1
stacks := []string{}
for {
if len(stacks) >= STACK_LENGTH {
break
}
if rand.Intn(2) == 1 {
stacks = append(stacks, RandomString(rand.Intn(5)+2))
} else {
for {
word := babbler.Babble()
if len(word) <= 6 {
stacks = append(stacks, strings.Title(word))
break
}
}
}
}
fmt.Println(strings.Join(stacks, "/"))
}
func RandomString(n int) string {
var letter = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
b := make([]rune, n)
for i := range b {
b[i] = letter[rand.Intn(len(letter))]
}
if rand.Intn(2) == 1 {
return strings.ToUpper(string(b))
} else {
return strings.Title(string(b))
}
}