Example #1
0
func (state *State) Init() {
	state.Errors = map[string]int{}
	state.Events = map[string]time.Time{}
	state.Latency = map[string]*summstat.Stats{}
	state.Latency["Create"] = summstat.NewStats()
	state.Latency["Read"] = summstat.NewStats()
	state.Latency["Update"] = summstat.NewStats()
	state.Latency["Delete"] = summstat.NewStats()
	state.Latency["Query"] = summstat.NewStats()
}
Example #2
0
func main() {
	//	rand.Seed(int64(time.Now().Nanosecond()))
	r := make([]*stats.Stats, 4)
	for i := range r {
		r[i] = stats.NewStats()
		//		r[i].CreateBins(100, 0, 200)
	}
	const n = 100000
	for i := 0; i < n; i++ {
		cs := []*character{
			newCharacter(jemimaPaths),
			newCharacter(peterPaths),
			newCharacter(squirrelPaths),
			newCharacter(jeremyPaths),
		}
		for i, c := range cs {
			r[i].AddSample(stats.Sample(c.play()))
		}
	}
	for i, s := range r {
		fmt.Printf("%d. min %g max %g mean %.2g±%.2g median %g\n", i, s.Min(), s.Max(), s.Mean(), s.Stddev(), s.Median())
	}
}