prng

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: 3 Imported by: 3

Documentation

Overview

Written in Go 2015 by Eric Lagergren (contact@ericlagergren.com)
Written in C 2014 by Sebastiano Vigna (vigna@acm.org) and
Kenji Rikitake (kenji.rikitake@acm.org).

To the extent possible under law, the author has dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.

See <http://creativecommons.org/publicdomain/zero/1.0/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Shift1024Star

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

Shift1024Star is a fast, top-quality generator. If 1024 bits of state are too much, try a xorshift128+ or generator.

The state must be seeded so that it is not everywhere zero. If you have a 64-bit seed, we suggest to seed a xorshift64* generator and use its output to fill s.

func (*Shift1024Star) Next

func (s *Shift1024Star) Next() uint64

func (*Shift1024Star) Seed

func (s *Shift1024Star) Seed()

type Shift116Plus

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

Shift116Plus is a variant of xorshift128+ for dynamic languages, such as Erlang, that can use only 58 bits of a 64-bit integer. Only the lower 58 bits of each state word are valid (the upper six are zeroes).

This generator passes BigCrush without systematic failures, but due to the relatively short period it is acceptable only for applications with a mild amount of parallelism; otherwise, use a xorshift1024* generator.

The state must be seeded so that the lower 58 bits of s[ 0 ] and s[ 1 ] are not all zeroes. If you have a nonzero 64-bit seed, we suggest to pass it twice through MurmurHash3's avalanching function and take the lower 58 bits, taking care that they are not all zeroes (you can apply the avalanching function again if this happens).

func (*Shift116Plus) Next

func (s *Shift116Plus) Next() uint64

func (*Shift116Plus) Seed

func (s *Shift116Plus) Seed()

type Shift128Plus

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

Shift128Plus is the fastest generator passing BigCrush without systematic failures, but due to the relatively short period it is acceptable only for applications with a mild amount of parallelism; otherwise, use a xorshift1024* generator.

The state must be seeded so that it is not everywhere zero. If you have a nonzero 64-bit seed, we suggest to pass it twice through MurmurHash3's avalanching function.

func (*Shift128Plus) Next

func (s *Shift128Plus) Next() uint64

func (*Shift128Plus) Seed

func (s *Shift128Plus) Seed()

type Shift4096Star

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

Shift40956 is usable, but we suggest you use a xorshift1024* generator.

The state must be seeded so that it is not everywhere zero. If you have a 64-bit seed, we suggest to seed a xorshift64* generator and use its output to fill s.

func (*Shift4096Star) Next

func (s *Shift4096Star) Next() uint64

func (*Shift4096Star) Seed

func (s *Shift4096Star) Seed()

type Shift64Star

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

Shift64Star is a fast, good generator if you're short on memory, but otherwise we rather suggest to use a xorshift128+ or xorshift1024* (for a very long period) generator.

func (*Shift64Star) Next

func (s *Shift64Star) Next() uint64

func (*Shift64Star) Seed

func (s *Shift64Star) Seed()

type XORShift

type XORShift interface {
	Next() uint64
	Seed()
}

Jump to

Keyboard shortcuts

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