Documentation ¶
Overview ¶
Package random provides an interface on top of math/rand to ease testing.
Index ¶
- func New() *rand.Rand
- func NewDummy() *rand.Rand
- func NewDummySource() rand.Source
- func NewLocked() *rand.Rand
- func NewLockedSource(src rand.Source) rand.Source
- func NewMockSource() *mockSource
- func NewSeeded(seed int64) *rand.Rand
- func NewSeededSource(seed int64) rand.Source
- func NewSource() rand.Source
- func NewStatic(value int64) *rand.Rand
- func NewStaticSource(value int64) rand.Source
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDummySource ¶
NewDummySource returns a rand.Source seeded with 0.
func NewLocked ¶
NewLocked returns a rand.Rand with a random source protected by a mutex. To be used for concurrent access.
func NewLockedSource ¶
NewLockedSource wraps the Source with a mutex. To be used for concurrent access.
func NewMockSource ¶
func NewMockSource() *mockSource
NewMockSource returns a mocked rand.Source. Configure each call before using.
func NewSeededSource ¶
NewSeededSource returns a seeded rand.Source, just like the rand package. Provided for API completeness
func NewSource ¶
NewSource returns a rand.Source seeded with the current time with nanoseconds precision.
func NewStatic ¶
NewStatic returns a rand.Rand that always returns the seeded value. Useful for tests.
func NewStaticSource ¶
NewStaticSource returns a rand.Source that always returns the seeded value. Useful for tests.
Types ¶
This section is empty.