prng

package
v0.0.0-...-d7ca77a Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: AGPL-3.0 Imports: 0 Imported by: 0

README

PRNG

PRNG provides generators to use for testing.

LCG32

Constants for LCG32 from Open Adventure.

Usage:

lcg32 := prng.LCG32(0)
for i := 0; i < 10; i++ {
    log.Println(lcg32())
}

SFC32

Code for SFC32 is from https://simblob.blogspot.com/2022/05/upgrading-prng.html#more .

Usage:

sfc32 := prng.SFC32(0, 12345, 0, 1)
for i := 0; i < 10; i++ {
    log.Println(sfc32())
}

Documentation

Overview

Package prng implements a motley assortment of psuedo-random number generators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PRNG

type PRNG func() uint32

PRNG is a generator.

func LCG32

func LCG32(x uint32) PRNG

LCG32 is from open adventure, maybe?

func SFC32

func SFC32(a, b, c, d uint32) PRNG

SFC32 is from https://simblob.blogspot.com/2022/05/upgrading-prng.html#more

Example

sfc32 := prng.SFC32(0, 12345, 0, 1)
for i := 0; i < 10; i++ {
	log.Println(sfc32())
}

func (PRNG) Roll

func (p PRNG) Roll(n, d int) (result int)

Jump to

Keyboard shortcuts

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