mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 03:11:01 -06:00
00e7c7c4b7
Before this change the tests for test datasource was not run.
23 lines
399 B
Go
23 lines
399 B
Go
package testdatasource
|
|
|
|
import (
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
type randomStringProvider struct {
|
|
r *rand.Rand
|
|
data []string
|
|
}
|
|
|
|
func newRandomStringProvider(data []string) *randomStringProvider {
|
|
return &randomStringProvider{
|
|
r: rand.New(rand.NewSource(time.Now().UnixNano())),
|
|
data: data,
|
|
}
|
|
}
|
|
|
|
func (p *randomStringProvider) Next() string {
|
|
return p.data[p.r.Int31n(int32(len(p.data)))]
|
|
}
|