nanorand / nanorand

Generate 6-digit numbers and so on with golang module NanoRand

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Go Report Card GoDoc Go Version Code Size Repo License Release


Logo

Nanorand

Nanosecond pseudo-random generator
View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

Nanorand Screen Shot

There are many great ways to generate "cryptographical-properly" 6-digit codes in Go; however, I didn't find one that really suited my needs. So I created this simplest one. I created a ONE line of code and few functions for creating array and long digit, for example: 127 length. It's so amazing. That be the best for you as soon as you try it -- I think this is it.

Here's why:

  • Your time should be focused on creating something amazing. A function GenerateShort for digit up to length of 7 is the faster than other ways, because it use nanosecond of time on your machine.
  • You shouldn't be doing google "How to generate 6-digit number" again and again. Just try it and you would love.
  • You should implement DRY principles to the rest of your life 😄

Of course, this project don't suite your purposes if you are creating Pentagon security system. In other way it works great. Use following instruction to install and use it.

(back to top)

Getting Started

This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.

Installation

 go get github.com/nanorand/nanorand

for other version

 go get github.com/nanorand/nanorand@vX.X.X

replace X for number of version. For example: v0.1.1

(back to top)

Usage

package main

import (
	"fmt"
	"github.com/nanorand/nanorand"
)

func main() {
	fmt.Println("6 digit code")

	code, err := nanorand.Gen(6)
	if err != nil {
		return
	}

	fmt.Println(code)
}

output:

798785

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Kirill Bogomolov - @manazoid - uralkir@gmail.com

Project Link: https://github.com/nanorand/nanorand

(back to top)

About

Generate 6-digit numbers and so on with golang module NanoRand

License:MIT License


Languages

Language:Go 100.0%