func main() {
	s := time.Seconds()
	n := time.Nanoseconds()
	fmt.Println(s)
	fmt.Println(n)

	a := time.Nanoseconds()
	time.Sleep(2 * 1e9)
	b := time.Nanoseconds()
	e := b - a
	fmt.Println(float64(e) * 1e-9)

	d := []float64{1, 2, 3}
	fmt.Println(stats.StatsSampleStandardDeviation(d))

}
Пример #2
0
func batchDemo() {
	fmt.Printf("\n**** Descriptive Statistics, Batch Updates **\n")
	fmt.Printf("** array of values:\n")
	a := makeArray(NUM_SAMPLES, 100, -25)
	printArray("x", a)
	fmt.Printf("}\n")
	fmt.Printf("then request stats, for example:    stats.StatsCount(a)\n")
	fmt.Printf("** Descriptive Statistics:\n")
	fmt.Printf("count = %v\n", stats.StatsCount(a))
	fmt.Printf("min = %v\n", stats.StatsMin(a))
	fmt.Printf("max = %v\n", stats.StatsMax(a))
	fmt.Printf("sum = %v\n", stats.StatsSum(a))
	fmt.Printf("mean = %v\n", stats.StatsMean(a))
	fmt.Printf("standard deviation = %v\n", stats.StatsSampleStandardDeviation(a))
	fmt.Printf("variance = %v\n", stats.StatsSampleVariance(a))
	fmt.Printf("skew = %v\n", stats.StatsSampleSkew(a))
	fmt.Printf("kurtosis = %v\n", stats.StatsSampleKurtosis(a))
}