示例#1
0
func main() {
	p := person.Person{}
	p.Data.Populate("")

	num := 10000
	t0 := time.Now()
	for i := 0; i < num; i++ {
		fmt.Printf("%v\n", person.FullName(p))
	}
	t1 := time.Now()
	fmt.Printf("\n%v Usernames generated and printed to stdout in %v (%v)\n", num, t1.Sub(t0), t1.Sub(t0).Seconds())

	num = 10000
	t0 = time.Now()
	for i := 0; i < num; i++ {
		person.FullName(p)
	}
	t1 = time.Now()
	fmt.Printf("\n%v Usernames generated in %v (%v)\n", num, t1.Sub(t0), t1.Sub(t0).Seconds())

	fmt.Printf("\n%v\n", lorem.Word())
	fmt.Printf("\n%v\n", lorem.Words(1))
	fmt.Printf("\n%v\n", lorem.Words(5))
	fmt.Printf("\n%v\n", lorem.Sentence(10))
	fmt.Printf("\n%v\n", lorem.Sentences(10))
	fmt.Printf("\n%v\n", lorem.Paragraph(10))
	fmt.Printf("\n\n\n%v\n", lorem.Paragraphs(3))
}
示例#2
0
文件: main.go 项目: wptad/dvara
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	defer s.ResponseTime.Start().Stop()
	defer s.ConcurrentRequests.Inc(1).Dec(1)
	s.NumRequests.Mark(1)
	time.Sleep(time.Duration(rand.Int63n(int64(s.MaxSleep))))
	bd := lorem.Sentences(rand.Intn(s.MaxSentences))
	s.PageSize.Update(int64(len(bd)))
	fmt.Fprint(w, bd, "\n")
}