rand

package
v0.0.0-...-6b453b2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

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

A Generator uses a goroutine to populate batches of random numbers. Currently we use a Mersenne twister implementation instead of the default Go implementation (which is fast, but has a much shorter period than MT, and we use a LOT of random draws)

func NewGenerator

func NewGenerator(seed int64) (*Generator, error)

NewGenerator is a helper wrapper around NewGeneratorSlice

func NewGeneratorSlice

func NewGeneratorSlice(seed []uint64) (*Generator, error)

NewGeneratorSlice starts a new background PRNG based on the given seed slice. If the slice has only one entry, then the MT generator is initialized with Seed. Otherwise SeedFromSlice is used

func (*Generator) Float64

func (g *Generator) Float64() float64

Float64 uses the commented, simpler implmentation since we don't have the same support requirements for users

func (*Generator) Int31

func (g *Generator) Int31() int32

Int31 is just a copy of the golang impl

func (*Generator) Int31n

func (g *Generator) Int31n(n int32) int32

Int31n is just a copy of the golang impL

func (*Generator) Int63

func (g *Generator) Int63() int64

Int63 provides the same interface as Go's math/rand, but with pre-generation.

func (*Generator) Int63n

func (g *Generator) Int63n(n int64) int64

Int63n is a copy of the current Go code

Jump to

Keyboard shortcuts

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