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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
package fake
import (
"strings"
)
// Character generates random character in the given language
func Character() string {
return lookup(lang, "characters", true)
}
// CharactersN generates n random characters in the given language
func CharactersN(n int) string {
var chars []string
for i := 0; i < n; i++ {
chars = append(chars, Character())
}
return strings.Join(chars, "")
}
// Characters generates from 1 to 5 characters in the given language
func Characters() string {
return CharactersN(r.Intn(5) + 1)
}
// Word generates random word
func Word() string {
return lookup(lang, "words", true)
}
// WordsN generates n random words
func WordsN(n int) string {
words := make([]string, n)
for i := 0; i < n; i++ {
words[i] = Word()
}
return strings.Join(words, " ")
}
// Words generates from 1 to 5 random words
func Words() string {
return WordsN(r.Intn(5) + 1)
}
// Title generates from 2 to 5 titleized words
func Title() string {
return strings.ToTitle(WordsN(2 + r.Intn(4)))
}
// Sentence generates random sentence
func Sentence() string {
var words []string
for i := 0; i < 3+r.Intn(12); i++ {
word := Word()
if r.Intn(5) == 0 {
word += ","
}
words = append(words, Word())
}
sentence := strings.Join(words, " ")
if r.Intn(8) == 0 {
sentence += "!"
} else {
sentence += "."
}
return sentence
}
// SentencesN generates n random sentences
func SentencesN(n int) string {
sentences := make([]string, n)
for i := 0; i < n; i++ {
sentences[i] = Sentence()
}
return strings.Join(sentences, " ")
}
// Sentences generates from 1 to 5 random sentences
func Sentences() string {
return SentencesN(r.Intn(5) + 1)
}
// Paragraph generates paragraph
func Paragraph() string {
return SentencesN(r.Intn(10) + 1)
}
// ParagraphsN generates n paragraphs
func ParagraphsN(n int) string {
var paragraphs []string
for i := 0; i < n; i++ {
paragraphs = append(paragraphs, Paragraph())
}
return strings.Join(paragraphs, "\t")
}
// Paragraphs generates from 1 to 5 paragraphs
func Paragraphs() string {
return ParagraphsN(r.Intn(5) + 1)
}
|