Documentation ¶
Index ¶
- func Bool() bool
- func Bytes(n int) []byte
- func Float32() float32
- func Float64() float64
- func Int() int
- func Int16() int16
- func Int31() int32
- func Int31n(n int32) int32
- func Int32() int32
- func Int63() int64
- func Int63n(n int64) int64
- func Int64() int64
- func Intn(n int) int
- func NewRand() *mrand.Rand
- func Perm(n int) []int
- func Reseed()
- func Seed(seed int64)
- func Str(length int) string
- func Time() time.Time
- func Uint() uint
- func Uint16() uint16
- func Uint32() uint32
- func Uint64() uint64
- type Rand
- func (r *Rand) Bool() bool
- func (r *Rand) Bytes(n int) []byte
- func (r *Rand) Float32() float32
- func (r *Rand) Float64() float64
- func (r *Rand) Int() int
- func (r *Rand) Int16() int16
- func (r *Rand) Int31() int32
- func (r *Rand) Int31n(n int32) int32
- func (r *Rand) Int32() int32
- func (r *Rand) Int63() int64
- func (r *Rand) Int63n(n int64) int64
- func (r *Rand) Int64() int64
- func (r *Rand) Intn(n int) int
- func (r *Rand) Perm(n int) []int
- func (r *Rand) Seed(seed int64)
- func (r *Rand) Str(length int) string
- func (r *Rand) Time() time.Time
- func (r *Rand) Uint() uint
- func (r *Rand) Uint16() uint16
- func (r *Rand) Uint32() uint32
- func (r *Rand) Uint64() uint64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRand ¶
NewRand returns a prng, that is seeded with OS randomness. The OS randomness is obtained from crypto/rand, however, like with any math/rand.Rand object none of the provided methods are suitable for cryptographic usage.
Note that the returned instance of math/rand's Rand is not suitable for concurrent use by multiple goroutines.
For concurrent use, call Reseed to reseed math/rand's default source and use math/rand's top-level convenience functions instead.
func Reseed ¶
func Reseed()
Reseed conveniently re-seeds the default Source of math/rand with randomness obtained from crypto/rand.
Note that this does not make math/rand suitable for cryptographic usage.
Use math/rand's top-level convenience functions remain suitable for concurrent use by multiple goroutines.
Types ¶
type Rand ¶ added in v0.0.6
func (*Rand) Intn ¶ added in v0.0.7
Intn returns, as an int, a uniform pseudo-random number in the range [0, n). It panics if n <= 0.
func (*Rand) Perm ¶ added in v0.0.7
Perm returns a pseudo-random permutation of n integers in [0, n).