Documentation
¶
Overview ¶
Package pcg64 implements the PCG-64 random number generator.
Index ¶
- type PCG64
- func (p *PCG64) Float32() float32
- func (p *PCG64) Float64() float64
- func (p *PCG64) Int(n int) int
- func (p *PCG64) Int32() int32
- func (p *PCG64) Int64() int64
- func (p *PCG64) Marshal() ([]byte, error)
- func (p *PCG64) Next() uint64
- func (p *PCG64) Reset()
- func (p *PCG64) Seed(seed uint64)
- func (p *PCG64) State() (uint64, uint64, uint64, uint64)
- func (p *PCG64) Uint32() uint32
- func (p *PCG64) Unmarshal(data []byte) error
- type SafePCG64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PCG64 ¶
type PCG64 struct {
// contains filtered or unexported fields
}
PCG64 represents the state of a PCG-64 random number generator.
func (*PCG64) Marshal ¶
Marshal returns the binary encoding of the current state of the random number generator.
func (*PCG64) Reset ¶
func (p *PCG64) Reset()
Reset resets the state of the random number generator to the seed value.
func (*PCG64) Seed ¶
Seed initializes the state of the random number generator with the given seed value.
type SafePCG64 ¶
type SafePCG64 struct {
PCG64
// contains filtered or unexported fields
}
SafePCG64 represents the state of a PCG-64 random number generator with a mutex to make it safe for concurrent use.
func NewSafe ¶
func NewSafe() *SafePCG64
NewSafe creates a new safe PCG64 instance seeded with the current time.
func (*SafePCG64) Float64 ¶
Float64 generates a random float64 in the range [0.0, 1.0), which is safe for concurrent use.
func (*SafePCG64) Next ¶
Next generates a random 64-bit unsigned integer, which is safe for concurrent use.
func (*SafePCG64) Reset ¶
func (p *SafePCG64) Reset()
Reset resets the state of the random number generator to the seed value, which is safe for concurrent use.