pcg

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: CC0-1.0 Imports: 2 Imported by: 2

README

PACKAGE DOCUMENTATION

package pcg
    import "github.com/zeebo/pcg"


FUNCTIONS

func Float32() float32
    Float32 returns a float32 uniformly in [0, 1). Safe for concurrent
    callers.

func Float64() float64
    Float64 returns a float64 uniformly in [0, 1). Safe for concurrent
    callers.

func Uint32() uint32
    Uint32 returns a random uint32. Safe for concurrent callers.

func Uint32n(n uint32) uint32
    Uint32n returns a uint32 uniformly in [0, n). Safe for concurrent
    callers.

func Uint64() uint64
    Uint64 returns a random uint64. Safe for concurrent callers.

TYPES

type PT struct {
    // contains filtered or unexported fields
}
    PT is a thread safe pcg generator. The output is non-deterministic, even
    if all of the calls are single threaded. The zero value is valid.

func NewParallel(state uint64) PT
    New constructs a parallel pcg with the given state.

func (p *PT) Float32() float32
    Float32 returns a float32 uniformly in [0, 1). Safe for concurrent
    callers.

func (p *PT) Float64() float64
    Float64 returns a float64 uniformly in [0, 1). Safe for concurrent
    callers.

func (p *PT) Uint32() uint32
    Uint32 returns a random uint32. Safe for concurrent callers.

func (p *PT) Uint32n(n uint32) uint32
    Uint32n returns a uint32 uniformly in [0, n). Safe for concurrent
    callers.

func (p *PT) Uint64() uint64
    Uint64 returns a random uint64. Safe for concurrent callers.

type T struct {
    // contains filtered or unexported fields
}
    T is a pcg generator. The zero value is valid.

func New(state uint64) T
    New constructs a pcg with the given state.

func (p *T) Float32() float32
    Float32 returns a float32 uniformly in [0, 1). Not safe for concurrent
    callers.

func (p *T) Float64() float64
    Float64 returns a float64 uniformly in [0, 1). Not safe for concurrent
    callers.

func (p *T) Uint32() uint32
    Uint32 returns a random uint32. Not safe for concurrent callers.

func (p *T) Uint32n(n uint32) uint32
    Uint32n returns a uint32 uniformly in [0, n). Not safe for concurrent
    callers.

func (p *T) Uint64() uint64
    Uint64 returns a random uint64. Not safe for concurrent callers.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Float32

func Float32() float32

Float32 returns a float32 uniformly in [0, 1). Safe for concurrent callers.

func Float64

func Float64() float64

Float64 returns a float64 uniformly in [0, 1). Safe for concurrent callers.

func Uint32

func Uint32() uint32

Uint32 returns a random uint32. Safe for concurrent callers.

func Uint32n

func Uint32n(n uint32) uint32

Uint32n returns a uint32 uniformly in [0, n). Safe for concurrent callers.

func Uint64

func Uint64() uint64

Uint64 returns a random uint64. Safe for concurrent callers.

Types

type PT

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

PT is a thread safe pcg generator. The output is non-deterministic, even if all of the calls are single threaded. The zero value is valid.

func NewParallel

func NewParallel(state uint64) PT

New constructs a parallel pcg with the given state.

func (*PT) Float32

func (p *PT) Float32() float32

Float32 returns a float32 uniformly in [0, 1). Safe for concurrent callers.

func (*PT) Float64

func (p *PT) Float64() float64

Float64 returns a float64 uniformly in [0, 1). Safe for concurrent callers.

func (*PT) Uint32

func (p *PT) Uint32() uint32

Uint32 returns a random uint32. Safe for concurrent callers.

func (*PT) Uint32n

func (p *PT) Uint32n(n uint32) uint32

Uint32n returns a uint32 uniformly in [0, n). Safe for concurrent callers.

func (*PT) Uint64

func (p *PT) Uint64() uint64

Uint64 returns a random uint64. Safe for concurrent callers.

type T

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

T is a pcg generator. The zero value is valid.

func New

func New(state uint64) T

New constructs a pcg with the given state.

func (*T) Float32

func (p *T) Float32() float32

Float32 returns a float32 uniformly in [0, 1). Not safe for concurrent callers.

func (*T) Float64

func (p *T) Float64() float64

Float64 returns a float64 uniformly in [0, 1). Not safe for concurrent callers.

func (*T) Uint32

func (p *T) Uint32() uint32

Uint32 returns a random uint32. Not safe for concurrent callers.

func (*T) Uint32n

func (p *T) Uint32n(n uint32) uint32

Uint32n returns a uint32 uniformly in [0, n). Not safe for concurrent callers.

func (*T) Uint64

func (p *T) Uint64() uint64

Uint64 returns a random uint64. Not safe for concurrent callers.

Jump to

Keyboard shortcuts

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