go-chart/sequence/random.go

22 lines
306 B
Go
Raw Normal View History

2017-04-30 00:12:39 -04:00
package sequence
import "math/rand"
type Random struct {
rnd *rand.Rand
scale *float64
average *float64
len int
}
func (r *Random) Len() int {
return r.len
}
func (r *Random) GetValue(_ int) float64 {
if r.scale != nil {
return r.rnd.Float64() * *r.scale
}
return r.rnd.Float64()
}