github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/util/randomword/generator.go (about) 1 package randomword 2 3 import ( 4 "fmt" 5 "math/rand" 6 "strings" 7 "time" 8 ) 9 10 const adjectives = `accountable 11 active 12 agile 13 anxious 14 appreciative 15 balanced 16 boisterous 17 bold 18 boring 19 brash 20 brave 21 bright 22 busy 23 chatty 24 cheerful 25 chipper 26 comedic 27 courteous 28 daring 29 delightful 30 empathic 31 excellent 32 exhausted 33 fantastic 34 fearless 35 fluent 36 forgiving 37 friendly 38 funny 39 generous 40 grateful 41 grouchy 42 grumpy 43 happy 44 hilarious 45 humble 46 impressive 47 insightful 48 intelligent 49 interested 50 kind 51 lean 52 nice 53 noisy 54 optimistic 55 patient 56 persistent 57 proud 58 quick 59 quiet 60 reflective 61 relaxed 62 reliable 63 responsible 64 responsive 65 rested 66 restless 67 shiny 68 shy 69 silly 70 sleepy 71 smart 72 spontaneous 73 surprised 74 sweet 75 talkative 76 terrific 77 thankful 78 timely 79 tired 80 turbulent 81 unexpected 82 wacky 83 wise 84 zany` 85 86 const nouns = `ardvark 87 aligator 88 antelope 89 baboon 90 badger 91 bandicoot 92 bat 93 bear 94 bilby 95 bongo 96 bonobo 97 buffalo 98 bushbuck 99 camel 100 cassowary 101 cat 102 cheetah 103 chimpanzee 104 chipmunk 105 civet 106 crane 107 crocodile 108 dingo 109 dog 110 dugong 111 duiker 112 echidna 113 eland 114 elephant 115 emu 116 fossa 117 fox 118 gazelle 119 gecko 120 gelada 121 genet 122 gerenuk 123 giraffe 124 gnu 125 gorilla 126 grysbok 127 hartebeest 128 hedgehog 129 hippopotamus 130 hyena 131 hyrax 132 impala 133 jackal 134 jaguar 135 kangaroo 136 klipspringer 137 koala 138 kob 139 kookaburra 140 kudu 141 lemur 142 leopard 143 lion 144 lizard 145 llama 146 lynx 147 manatee 148 mandrill 149 meerkat 150 mongoose 151 mouse 152 numbat 153 nyala 154 okapi 155 oribi 156 oryx 157 ostrich 158 otter 159 panda 160 pangolin 161 panther 162 parrot 163 platypus 164 porcupine 165 possum 166 puku 167 quokka 168 quoll 169 rabbit 170 ratel 171 raven 172 reedbuck 173 rhinocerous 174 roan 175 sable 176 serval 177 shark 178 sitatunga 179 springhare 180 squirrel 181 swan 182 tiger 183 topi 184 toucan 185 turtle 186 wallaby 187 warthog 188 waterbuck 189 wildebeest 190 wolf 191 wolverine 192 wombat 193 zebra` 194 195 type Generator struct{} 196 197 func (gen Generator) Babble() string { 198 return fmt.Sprintf("%s-%s", gen.RandomAdjective(), gen.RandomNoun()) 199 } 200 201 func (Generator) RandomAdjective() string { 202 return randomElement(adjectives) 203 } 204 205 func (Generator) RandomNoun() string { 206 return randomElement(nouns) 207 } 208 209 func randomElement(fullList string) string { 210 rand.Seed(time.Now().UnixNano()) 211 wordList := strings.Split(fullList, "\n") 212 randomWordIndex := rand.Int() % len(wordList) 213 214 return wordList[randomWordIndex] 215 }