go-random

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: MIT

README

go-random

CI

go-random provides generic random number generator interfaces and functions.

Usage

Use go get to install:

go get github.com/susisu/go-random

go-random provides functions for both uint32 and uint64 generators. The functions for each type are exported from separate pacakges, so use the appropriate one for your use case.

Here is an example using the uint64 version:

import (
	"math/rand"

	random "github.com/susisu/go-random/uint64"
)

func main() {
	// math/rand.Source64 implements the uint64 version of random.Generator
	g := rand.NewSource(42).(rand.Source64)
	// use go-random to generate random values of variaous numeric types
	v := random.Float64(g)
	fmt.Printf("%f\n", v)
}

License

MIT License

Author

Susisu (GitHub, Twitter)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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