Zibon50 / randomizer

GoLang library for generating cryptographically secure random numbers using the crypto/rand package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

randomizer

Coverage Status CI Build CI Test CI Scan CI Release Go Reference

This is a GoLang library for generating cryptographically secure random numbers using the crypto/rand package. The library provides a simple API for generating random integers, bytes, and strings.

Installation

To install the library, use the go get command:

go get github.com/imusmanmalik/randomizer

Usage

To use the library, import it in your Go code:

import (
    "fmt"
    "github.com/imusmanmalik/randomizer"
)

func main() {
    // Generate a random integer between 0 and 100
    n := yourpackage.RandomInt(100)
    fmt.Println(n)

    // Generate a random byte slice with 16 bytes
    b := yourpackage.RandomBytes(16)
    fmt.Printf("%x\n", b)

    // Generate a random string with 10 characters
    s := yourpackage.RandomString(10)
    fmt.Println(s)
}

Testing

go test

Contributing

Contributions are welcome! If you find a bug or have an idea for a new feature, please open an issue or submit a pull request on GitHub.

License

This library is licensed under Apache 2.0 License. See the LICENSE file for details.

Acknowledgments

This library was inspired by the math/rand package in the Go standard library, and the github.com/Pallinder/go-randomdata library.

About

GoLang library for generating cryptographically secure random numbers using the crypto/rand package

License:Apache License 2.0


Languages

Language:Go 100.0%