https://github.com/techmdw/randish
Randish is a thread-safe random number generator library in Go, providing distinct random sequences with a unique seeding approach based on a mix of system and context-specific elements. It offers singleton and array-based pseudo-random number generation, ensuring high performance and randomness across different contexts and systems.
https://github.com/techmdw/randish
go golang pseudo-random random-seed
Last synced: about 1 year ago
JSON representation
Randish is a thread-safe random number generator library in Go, providing distinct random sequences with a unique seeding approach based on a mix of system and context-specific elements. It offers singleton and array-based pseudo-random number generation, ensuring high performance and randomness across different contexts and systems.
- Host: GitHub
- URL: https://github.com/techmdw/randish
- Owner: TechMDW
- License: mit
- Created: 2023-06-21T17:20:18.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-22T12:13:06.000Z (almost 3 years ago)
- Last Synced: 2025-03-07T06:57:08.603Z (about 1 year ago)
- Topics: go, golang, pseudo-random, random-seed
- Language: Go
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Randish
`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.
## Features
- `Rand()`: Generates a new pseudo-random number generator that is initialized with a unique seed value.
- `RandS()`: Singleton and thread-safe variant of the `Rand()` 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.
## Getting Started
### Prerequisites
- Go 1.7 or later
### Installation
1. Download `randish` using the go get command:
```
go get github.com/TechMDW/randish
```
2. Import `randish` in your code:
```go
import "github.com/TechMDW/randish"
```
3. Use the functions as needed.
## Usage
Here is an example of how to use `randish` in your Go code:
```go
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)
}
```
## TODO
- [x] Write README
- [ ] Version control
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Contact
Maintained by @TechMDW - contact@techmdw.com - Feel free to contact us if you have any questions.