Skip to content

Latest commit

 

History

History
34 lines (18 loc) · 951 Bytes

README.md

File metadata and controls

34 lines (18 loc) · 951 Bytes

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.