twister64

package
v0.0.0-...-72f2e88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
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 Int

func Int() int

Int returns a random, non-negative int.

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

func IntN(n uint64) uint64

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.

func Real3

func Real3() float64

Real3 generates a random number on (0,1)-real-interval from the global MT19937.

func Seed

func Seed(seed int64)

Seed seeds the global MT19937 with the given seed.

func Warmup

func Warmup()

Warmup warms up the PRNG by running a 64-bit prime number of iterations.

Types

type MT19937

type MT19937 struct {
	// contains filtered or unexported fields
}

MT19937 holds the state of a Mersenne Twister.

func New

func New() *MT19937

New returns an unseeded, initialized MT19937.

func NewMersenne

func NewMersenne(seed int64) *MT19937

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) Int

func (m *MT19937) Int() int

Int returns a random, non-negative int.

func (*MT19937) Int63

func (m *MT19937) Int63() int64

Int63 generates a random number on [0, 2^63-1]-interval from the given MT19937.

func (*MT19937) Int64

func (m *MT19937) Int64() uint64

Int64 generates a random number on [0, 2^64-1]-interval.

func (*MT19937) IntN

func (m *MT19937) IntN(n uint64) uint64

IntN generates a random number on [0, 2^64-1]-interval within the given range, n.

func (*MT19937) Real1

func (m *MT19937) Real1() float64

Real1 generates a random number on [0,1]-real-interval from the given MT19937.

func (*MT19937) Real2

func (m *MT19937) Real2() float64

Real2 generates a random number on [0,1)-real-interval from the given MT19937.

func (*MT19937) Real3

func (m *MT19937) Real3() float64

Real3 generates a random number on (0,1)-real-interval from the given MT19937.

func (*MT19937) Seed

func (m *MT19937) Seed(seed int64)

Seed seeds an MT19937 with the given seed.

func (*MT19937) SeedArray

func (m *MT19937) SeedArray(initKey [NN]uint64)

SeedArray seeds an MT19937 with the given array.

func (*MT19937) Warmup

func (m *MT19937) Warmup()

Warmup warms up the PRNG by running a 64-bit prime number of iterations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL