pcg

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2019 License: ISC Imports: 2 Imported by: 0

Documentation

Overview

Package pcg provides an implementation of the PCG XSL RR 128/64 pseudo random number generator.

Full details can be found at the PCG-Random website (http://www.pcg-random.org/). This version of the code provides a single member of the PCG family, PCG XSL RR 128/64 (LCG).

Use of this algorithm is governed by a MIT-style license that can be found in the LICENSE-pcg file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rng

type Rng struct {
	LO uint64 // low 64 bits of 128 bits state
	HI uint64 // high 64 bits of 128 bits state
}

Rng encapsulates a PCG XSL RR 128/64 (LCG) PRNG.

This is a permuted congruential generator as defined in

PCG: A Family of Simple Fast Space-Efficient Statistically Good Algorithms for Random Number Generation
Melissa E. O'Neill, Harvey Mudd College
https://www.cs.hmc.edu/tr/hmc-cs-2014-0905.pdf

func (*Rng) Int63

func (rng *Rng) Int63() int64

Int63 returns a non-negative pseudo-random 63-bit integer as an int64.

func (*Rng) Seed

func (rng *Rng) Seed(seed int64)

Seed uses the provided seed value to initialize the generator to a deterministic state.

func (*Rng) Uint64

func (rng *Rng) Uint64() uint64

Uint64 returns a pseudo-random 64-bit value as a uint64.

Jump to

Keyboard shortcuts

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