Randish
is a Go package that provides pseudo-random number generators which are unique and thread-safe.
Do not use this for cryptography! If you need a package for that purpose, please use the crypto/rand
package instead.
Rand()
: Generates a new pseudo-random number generator that is initialized with a unique seed value.RandS()
: Singleton and thread-safe variant of theRand()
function. Returns a globally unique instance of a pseudo-random number generator.RandSA()
: Initializes an array of pseudo-random number generators and returns one from the array using pseudo-random selection.Seed()
: Function that generates a seed for pseudo-random number generation using various system and context-specific elements.
- Go 1.7 or later
- Download
randish
using the go get command:go get github.com/TechMDW/randish
- Import
randish
in your code:import "github.com/TechMDW/randish"
- Use the functions as needed.
Here is an example of how to use randish
in your Go code:
package main
import (
"github.com/TechMDW/randish"
)
func main() {
// Generate a new random number generator
//
// Returns the *rand.Rand from "math/rand" package
r := randish.Rand()
// Generate a random number
num := r.Int()
println(num)
}
- Write README
- Version control
This project is licensed under the MIT License - see the LICENSE file for details.
Maintained by @TechMDW - contact@techmdw.com - Feel free to contact us if you have any questions.