xoroshiro

package module
v0.0.0-...-26d2b3e Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: Unlicense Imports: 0 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-xoroshiro: xoroshiro128+ RNG

godoc: https://godoc.org/github.com/dgryski/go-xoroshiro

Documentation

Overview

Package xoroshiro implements the xoroshiro128+ RNG

This is a literal translation of http://xoroshiro.di.unimi.it/xoroshiro128plus.c and http://xoroshiro.di.unimi.it/splitmix64.c

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SplitMix64

type SplitMix64 uint64

SplitMix64 is an RNG with 64-bits of state

func (*SplitMix64) Next

func (x *SplitMix64) Next() uint64

Next returns the next number in the sequence

type State

type State [2]uint64

State is a xoroshiro128+ RNG state.

Example
// If you have 128 bits of randomness for a seed, use those.
// If you have a single 64-bit seed, generate more with SplitMix64.

seed := SplitMix64(0x0ddc0ffeebadf00d)

s := State([2]uint64{seed.Next(), seed.Next()})

for i := 0; i < 10; i++ {
	fmt.Println(s.Next())
}
Output:
11814330020949985800
11817088786836023749
1654166990350674155
14112748191344281834
4288295283113472773
8391955421631067594
168274855724945977
2815117763357611551
12187186948608395331
10629044371437376348

func New

func New(seed int64) State

New returns a new RNG

func (*State) Int63

func (s *State) Int63() int64

func (*State) Int63n

func (s *State) Int63n(n int64) int64

Int63n returns a uniform integer [0, n)

func (*State) Jump

func (s *State) Jump()

func (*State) Next

func (s *State) Next() uint64

Next returns the next number in the sequence

func (*State) Seed

func (s *State) Seed(seed int64)

Jump to

Keyboard shortcuts

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