func ExampleNewStrider() { data := statistics.Float64{ .0421, .0941, .1064, .0242, .1331, .0773, .0243, .0815, .1186, .0356, .0728, .0999, .0614, .0479} strider := statistics.NewStrider(&data, 4) fmt.Printf("mean data is %.4f\n", statistics.Mean(&data)) fmt.Printf("mean strider is %.4f\n", statistics.Mean(strider)) // Output: // mean data is 0.0728 // mean strider is 0.0979 }
func ExampleStrider() { data := statistics.Float64{ .0421, .0941, .1064, .0242, .1331, .0773, .0243, .0815, .1186, .0356, .0728, .0999, .0614, .0479} strider := statistics.NewStrider(&data, 4) for i := 0; i < strider.Len(); i++ { fmt.Println(strider.Value(i)) } // Output: // 0.0421 // 0.1331 // 0.1186 }