Pallinder / go-randomdata

A tiny generator of random data for golang, also known as a faker
MIT License
940 stars 96 forks source link

Feature Request: Random sentence #58

Open zwl1619 opened 6 years ago

zwl1619 commented 6 years ago

Hi,
Could you add a sentence generator?When generating some articles ,title and content are needed,content can be generated by randomdata.Paragraph(),but I don't find which one should be used for generating title.

For example:

// Print a sentence
fmt.Println(randomdata.Sentence())
Sapphire64 commented 5 years ago

I do something like this:

func generateTitleAndText(textLen uint) (string, string) {
    title := fmt.Sprintf("%v %v", randomdata.SillyName(), randomdata.SillyName())

    text := []string{randomdata.SillyName()}
    var i uint
    for i = 0; i < textLen; i++ {
        text = append(text, strings.ToLower(randomdata.SillyName()))
    }

    return title, strings.Join(text[:], " ")
}

But really would be nice to have a lorem ipsum kind of generator built-in.