pcg

package module
v0.0.0-...-df440c6 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2018 License: Apache-2.0 Imports: 0 Imported by: 20

README

pcg

Go implementation of Melissa O'Neill's excellent PCG pseudorandom number generator, which is well-studied, excellent, and fast both to create and in execution.

  Performance on a MacBook Pro:

  $ go test -v -bench=.
  === RUN   TestSanity32
  --- PASS: TestSanity32 (0.00s)
  === RUN   TestSum32
  --- PASS: TestSum32 (0.00s)
  === RUN   TestAdvance32
  --- PASS: TestAdvance32 (0.00s)
  === RUN   TestRetreat32
  --- PASS: TestRetreat32 (0.00s)
  === RUN   TestSanity64
  --- PASS: TestSanity64 (0.00s)
  === RUN   TestSum64
  --- PASS: TestSum64 (0.00s)
  === RUN   TestAdvance64
  --- PASS: TestAdvance64 (0.00s)
  === RUN   TestRetreat64
  --- PASS: TestRetreat64 (0.00s)
  === RUN   ExampleReport32
  --- PASS: ExampleReport32 (0.00s)
  === RUN   ExampleReport64
  --- PASS: ExampleReport64 (0.00s)
  BenchmarkNew32-8      2000000000               1.09 ns/op
  BenchmarkRandom32-8   1000000000               2.49 ns/op
  BenchmarkBounded32-8  200000000                9.75 ns/op
  BenchmarkNew64-8      200000000                6.89 ns/op
  BenchmarkRandom64-8   200000000                7.58 ns/op
  BenchmarkBounded64-8  50000000                25.5 ns/op

Provided under terms of the Apache license in keeping with Melissa O'Neill's original from which this was ported.

Copyright 2018 Michael T. Jones

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PCG32

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

func NewPCG32

func NewPCG32() *PCG32

func (*PCG32) Advance

func (p *PCG32) Advance(delta uint64) *PCG32

func (*PCG32) Bounded

func (p *PCG32) Bounded(bound uint32) uint32

func (*PCG32) Random

func (p *PCG32) Random() uint32

func (*PCG32) Retreat

func (p *PCG32) Retreat(delta uint64) *PCG32

func (*PCG32) Seed

func (p *PCG32) Seed(state, sequence uint64) *PCG32

type PCG64

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

func NewPCG64

func NewPCG64() *PCG64

func (*PCG64) Advance

func (p *PCG64) Advance(delta uint64) *PCG64

func (*PCG64) Bounded

func (p *PCG64) Bounded(bound uint64) uint64

func (*PCG64) Random

func (p *PCG64) Random() uint64

func (*PCG64) Retreat

func (p *PCG64) Retreat(delta uint64) *PCG64

func (*PCG64) Seed

func (p *PCG64) Seed(state1, state2, sequence1, sequence2 uint64) *PCG64

Jump to

Keyboard shortcuts

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