mt19937b64

package
v0.0.0-...-17533aa Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package mt19937b64 is an implementation of Mersenne Twister 64bit algorithm.

References: T. Nishimura, “Tables of 64-bit Mersenne Twisters”

ACM Transactions on Modeling and
Computer Simulation 10. (2000) 348--357.

M. Matsumoto and T. Nishimura,

  ``Mersenne Twister: a 623-dimensionally equidistributed
	uniform pseudorandom number generator''
  ACM Transactions on Modeling and
  Computer Simulation 8. (Jan. 1998) 3--30.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

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

Source is a random source using Mersenne Twister 64bit algorithm.

http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt64.html

Example
package main

import (
	"fmt"

	"github.com/shogo82148/randsrc/mt19937"
)

func main() {
	var src mt19937.Source
	src.SeedBySlice([]uint32{0x123, 0x234, 0x345, 0x456})
	for i := 0; i < 10; i++ {
		fmt.Println(src.Uint32())
	}
}
Output:
1067595299
955945823
477289528
4107218783
4228976476
3344332714
3355579695
227628506
810200273
2591290167

func New

func New(mt [312]uint64) *Source

New create a new source.

func (*Source) Int63

func (s *Source) Int63() int64

Int63 implements math/rand.Source.

func (*Source) Seed

func (s *Source) Seed(seed int64)

Seed implements math/rand.Source.

func (*Source) SeedBySlice

func (s *Source) SeedBySlice(initKey []uint64)

SeedBySlice initializes the state by initKey.

func (*Source) Uint64

func (s *Source) Uint64() uint64

Uint64 implements math/rand.Source64

Jump to

Keyboard shortcuts

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