Make the usage example copy and paste-able
- Id
- fcc80537babd5c9bedf6950f579c24df6174559d
- Author
- Caio
- Commit time
- 2015-08-25T20:00:09-03:00
Modified README.md
## Usage
- import ("github.com/caio/go-tdigest" "math/rand" "fmt")
+ package main
- compression := 10
- t := tdigest.New(compression)
+ import (
+ "fmt"
+ "math/rand"
- for i := 0; i < 10000; i++ {
- t.Update(rand.Float64(), 1)
+ "github.com/caio/go-tdigest"
+ )
+
+ func main() {
+ var t = tdigest.New(100)
+
+ for i := 0; i < 10000; i++ {
+ t.Update(rand.Float64(), 1)
+ }
+
+ fmt.Printf("p(.5) = %.6f\n", t.Percentile(0.5))
}
-
- fmt.Printf("p(.5) = %.6f\n", t.Percentile(0.5))
## Disclaimer