vendor/github.com/lucasb-eyer/go-colorful/rand.go
raw| 1 | package colorful |
| 2 | |
| 3 | import "math/rand" |
| 4 | |
| 5 | type RandInterface interface { |
| 6 | Float64() float64 |
| 7 | Intn(n int) int |
| 8 | } |
| 9 | |
| 10 | type defaultGlobalRand struct{} |
| 11 | |
| 12 | func (df defaultGlobalRand) Float64() float64 { |
| 13 | return rand.Float64() |
| 14 | } |
| 15 | |
| 16 | func (df defaultGlobalRand) Intn(n int) int { |
| 17 | return rand.Intn(n) |
| 18 | } |
| 19 | |
| 20 | func getDefaultGlobalRand() RandInterface { |
| 21 | return defaultGlobalRand{} |
| 22 | } |