Documentation ¶
Index ¶
- Constants
- func Int() int
- func Int63() int64
- func Int64() uint64
- func IntN(n uint64) uint64
- func Real1() float64
- func Real2() float64
- func Real3() float64
- func Seed(seed int64)
- func Warmup()
- type MT19937
- func (m *MT19937) Int() int
- func (m *MT19937) Int63() int64
- func (m *MT19937) Int64() uint64
- func (m *MT19937) IntN(n uint64) uint64
- func (m *MT19937) Real1() float64
- func (m *MT19937) Real2() float64
- func (m *MT19937) Real3() float64
- func (m *MT19937) Seed(seed int64)
- func (m *MT19937) SeedArray(initKey [NN]uint64)
- func (m *MT19937) Warmup()
Constants ¶
const ( NN = 312 MM = 156 MatrixA = 0xB5026F5AA96619E9 UM = 0xFFFFFFFF80000000 // Most significant 33 bits LM = 0x7FFFFFFF // Least significant 31 bits )
Variables ¶
This section is empty.
Functions ¶
func Int63 ¶
func Int63() int64
Int63 generates a random number on [0, 2^63-1]-interval from the global MT19937.
func Int64 ¶
func Int64() uint64
Int64 generates a random number on [0, 2^64-1]-interval from the global MT19937.
func IntN ¶
IntN generates a random number on [0, 2^64-1]-interval within the given range, n, from the global MT19937.
func Real1 ¶
func Real1() float64
Real1 generates a random number on [0,1]-real-interval from the global MT19937.
func Real2 ¶
func Real2() float64
Real2 generates a random number on [0,1)-real-interval from the global MT19937.
Types ¶
type MT19937 ¶
type MT19937 struct {
// contains filtered or unexported fields
}
MT19937 holds the state of a Mersenne Twister.
func NewMersenne ¶
NewMersenne returns a seeded, initialized MT19937.
func NewMersennePrime ¶
func NewMersennePrime() *MT19937
NewMersennePrime returns a seeded, initialized MT19937, seeded using a large from from 'crypto/rand'. Will panic if rand.Prime returns an error.
func (*MT19937) Int63 ¶
Int63 generates a random number on [0, 2^63-1]-interval from the given MT19937.
func (*MT19937) IntN ¶
IntN generates a random number on [0, 2^64-1]-interval within the given range, n.
func (*MT19937) Real1 ¶
Real1 generates a random number on [0,1]-real-interval from the given MT19937.
func (*MT19937) Real2 ¶
Real2 generates a random number on [0,1)-real-interval from the given MT19937.
func (*MT19937) Real3 ¶
Real3 generates a random number on (0,1)-real-interval from the given MT19937.