Skip to content

This is a simple package for generating true random numbers, provided by random.org.

License

Notifications You must be signed in to change notification settings

elsni/truerandom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

truerandom

This is a simple go package for generating true random numbers, provided by random.org.

It creates integer and float64 random numbers within a given range.

Usage

you first need to create a generator object:

gen, err := NewIntGenerator(min, max, num)

or

gen, err := NewFloatGenerator(min, max, num)

Then you can get a random number like this:

myrandomnumber := gen.Rand()

Parameters

min: the minimum random value created

max: the maximum random value created

num: the amount of numbers created internally

example

if min is 4 and max is 45, the smallest random numer is 4 and the largest is 45.

the num parameters describes how many random numbers are fetched from random.org in one go. If you ask for more numbers then initially fetched, the package fetches the next num numbers. It is planned to do that asynchonously but this is not yet implemented.

About

This is a simple package for generating true random numbers, provided by random.org.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages