truerandom

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 6 Imported by: 0

README

truerandom

This is a simple 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)

Parameters

min: the minimum random walue created min: the maximum random walue 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FloatGenerator

type FloatGenerator struct {
	Min        float64
	Max        float64
	Buffersize int
	// contains filtered or unexported fields
}

func NewFloatGenerator

func NewFloatGenerator(min float64, max float64, num int) (FloatGenerator, error)

func (*FloatGenerator) Rand

func (i *FloatGenerator) Rand() float64

func (*FloatGenerator) Refresh

func (i *FloatGenerator) Refresh() error

type IntGenerator

type IntGenerator struct {
	Min        int
	Max        int
	Buffersize int
	// contains filtered or unexported fields
}

func NewIntGenerator

func NewIntGenerator(min, max, num int) (IntGenerator, error)

func (*IntGenerator) Rand

func (i *IntGenerator) Rand() int

func (*IntGenerator) Refresh

func (i *IntGenerator) Refresh() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL