pcgr

package module
v0.0.0-...-4b34ab9 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 0 Imported by: 20 modules, 24 packages

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

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

Documentation

Overview

Package pcgr implements a small PCG random number generator

http://www.pcg-random.org/

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Rand

type Rand struct {
	State uint64
	Inc   uint64 // must be odd
}

Rand is a PCG random number generator. It implements the rand.Source interface.

func New

func New(seed, state int64) Rand

New returns an pcgr stream

func (*Rand) Advance

func (r *Rand) Advance(delta int)

Advance skips forward 'delta' steps in the stream. Delta can be negative in which case the stream in rewound.

func (*Rand) Bound

func (r *Rand) Bound(bound uint32) uint32

Bound returns a uniform integer 0..bound-1

func (*Rand) Float32

func (r *Rand) Float32() float32

func (*Rand) Int63

func (r *Rand) Int63() int64

Int63 returns a random 63-bit integer

func (*Rand) Next

func (r *Rand) Next() uint32

Next returns a random uint32

func (*Rand) Seed

func (r *Rand) Seed(seed int64)

Seed states the internal state of the rng

func (*Rand) SeedWithState

func (r *Rand) SeedWithState(initstate, initseq int64)

SeedWithState sets the internal state and sequence number of the rng

Jump to

Keyboard shortcuts

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