|
|
@ -88,30 +88,25 @@ func (w wordBag) randomWordBelow(n int) string {
|
|
|
|
func (w wordBag) wordString(n int) string {
|
|
|
|
func (w wordBag) wordString(n int) string {
|
|
|
|
var (
|
|
|
|
var (
|
|
|
|
buf bytes.Buffer
|
|
|
|
buf bytes.Buffer
|
|
|
|
remaining int
|
|
|
|
remaining = n
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
for {
|
|
|
|
for {
|
|
|
|
remaining = n - buf.Len()
|
|
|
|
|
|
|
|
switch {
|
|
|
|
switch {
|
|
|
|
case remaining < 0:
|
|
|
|
case remaining < 0:
|
|
|
|
return buf.String()
|
|
|
|
return buf.String()
|
|
|
|
case remaining < 8:
|
|
|
|
case remaining < 8:
|
|
|
|
buf.WriteString(w.randomWordN(remaining))
|
|
|
|
buf.WriteString(w.randomWordN(remaining))
|
|
|
|
if rand.Float64() > 0.8 {
|
|
|
|
|
|
|
|
buf.WriteRune('\n')
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
buf.WriteRune(' ')
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
buf.WriteString(w.randomWordBelow(remaining))
|
|
|
|
buf.WriteString(w.randomWordBelow(8))
|
|
|
|
if rand.Float64() > 0.8 {
|
|
|
|
}
|
|
|
|
|
|
|
|
remaining = n - buf.Len()
|
|
|
|
|
|
|
|
if multiline && remaining > 1 && rand.Float64() > 0.98 {
|
|
|
|
buf.WriteRune('\n')
|
|
|
|
buf.WriteRune('\n')
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
buf.WriteRune(' ')
|
|
|
|
buf.WriteRune(' ')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// command-line length argument parsing type. Line lengths can be specified as
|
|
|
|
// command-line length argument parsing type. Line lengths can be specified as
|
|
|
|