splitmix64

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

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 splitmix64 algorithm.

Guy L. Steele, Doug Lea, and Christine H. Flood. 2014. Fast splittable pseudorandom number generators. SIGPLAN Not. 49, 10 (October 2014), 453–472. DOI:https://doi.org/10.1145/2714064.2660195

http://docs.oracle.com/javase/8/docs/api/java/util/SplittableRandom.html http://prng.di.unimi.it/splitmix64.c

Example
package main

import (
	"fmt"
	"math/rand"

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

func main() {
	src := splitmix64.New(1)
	r := rand.New(src)
	for i := 0; i < 10; i++ {
		fmt.Println(r.Int63())
	}
}
Output:
5225608189600411232
6878622605533214259
8955919645141445295
4098490376910890117
4097618618563484380
7036458801432265024
8092113344071933522
4824443200034030266
2633352815946178260
7323326090023318475

func New

func New(state 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) 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