gocommon

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2019 License: MIT Imports: 4 Imported by: 0

README

gocommon

Common reusable Go routines.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decompf32

func Decompf32(val float32) (base, frac int32)

Decompf32 - Decompose a float32 value int two numbers. Given the following:

3.141592

The return values will be:

base = 3
frac = 141592

func Decompf64

func Decompf64(val float64) (base, frac int64)

Decompf64 - Decompose a float64 value int two numbers. Given the following:

3.141592

The return values will be:

base = 3
frac = 141592

func FileExists

func FileExists(filename string) bool

FileExists - checks if a file exists and is not a directory before we try using it to prevent further errors.

func Makef32

func Makef32(base, frac int32) float32

Makef32 - Make a float32 variable from two numbers. Given the following:

base = 3
frac = 141592

The return float64 value will be:

3.14159

func Makef64

func Makef64(base, frac int64) float64

Makef64 - Make a float64 variable from two numbers. Given the following:

base = 3
frac = 141592

The return float64 value will be:

3.14159

func Maxi

func Maxi(x, y int) int

Maxi - Return the larger int of x or y

func Maxi32

func Maxi32(x, y int32) int32

Maxi32 - Return the larger int32 of x or y

func Maxi64

func Maxi64(x, y int64) int64

Maxi64 - Return the larger int64 of x or y

func Maxu

func Maxu(x, y uint) uint

Maxu - Return the larger uint of x or y

func Maxu32

func Maxu32(x, y uint32) uint32

Maxu32 - Return the larger uint32 of x or y

func Maxu64

func Maxu64(x, y uint64) uint64

Maxu64 - Return the larger uint64 of x or y

func Mini

func Mini(x, y int) int

Mini - Return the smaller int of x or y

func Mini32

func Mini32(x, y int32) int32

Mini32 - Return the smaller int32 of x or y

func Mini64

func Mini64(x, y int64) int64

Mini64 - Return the smaller int64 of x or y

func Minu

func Minu(x, y uint) uint

Minu - Return the smaller uint of x or y

func Minu32

func Minu32(x, y uint32) uint32

Minu32 - Return the smaller uint32 of x or y

func Minu64

func Minu64(x, y uint64) uint64

Minu64 - Return the smaller uint64 of x or y

func Rotli

func Rotli(value int, count uint) int

Rotli - Rotate left int

func Rotli32

func Rotli32(value int32, count uint32) int32

Rotli32 - Rotate left int32

func Rotli64

func Rotli64(value int64, count uint32) int64

Rotli64 - Rotate left int64

func Rotlu

func Rotlu(value uint, count uint) uint

Rotlu - Rotate left uint

func Rotlu32

func Rotlu32(value uint32, count uint32) uint32

Rotlu32 - Rotate left uint32

func Rotlu64

func Rotlu64(value uint64, count uint32) uint64

Rotlu64 - Rotate left uint64

func Rotri

func Rotri(value int, count uint) int

Rotri - Rotate right int

func Rotri32

func Rotri32(value int32, count uint32) int32

Rotri32 - Rotate right int32

func Rotri64

func Rotri64(value int64, count uint32) int64

Rotri64 - Rotate right int64

func Rotru

func Rotru(value uint, count uint) uint

Rotru - Rotate right uint

func Rotru32

func Rotru32(value uint32, count uint32) uint32

Rotru32 - Rotate right uint32

func Rotru64

func Rotru64(value uint64, count uint32) uint64

Rotru64 - Rotate right uint64

Types

type IRandomGenerator

type IRandomGenerator interface {
	Next() uint64
}

IRandomGenerator - random number generator interface

type RandRersResrResdra

type RandRersResrResdra struct {
	// contains filtered or unexported fields
}

RandRersResrResdra - Use the RERS, RESR, and RESDRA generators

func (RandRersResrResdra) Next

func (rnd RandRersResrResdra) Next() uint64

Next - Generate random numbers with a very high random repeat period. Based on the article "Fast, High-Quality, Parallel Random Number Generators" by Mark A. Overton, published in Dr. Dobb's Journal on 24 May, 2011. http://drdobbs.com/go-parallel/article/229625477

type Random

type Random struct {
	// contains filtered or unexported fields
}

Random - Generate random numbers using the given random number generator.

func MakeRandom

func MakeRandom(rg IRandomGenerator) Random

MakeRandom - Instantiate a random number producer, given the random number generator.

func (Random) Next

func (rnd Random) Next() uint64

Next - Get the next random number

func (Random) Nextf32

func (rnd Random) Nextf32() float32

Nextf32 - Get the next random float32 number

func (Random) Nextf32n

func (rnd Random) Nextf32n(minVal float32, maxVal float32) float32

Nextf32n - Get the next random float32 number within the specified range

func (Random) Nextf64

func (rnd Random) Nextf64() float64

Nextf64 - Get the next random float64 number

func (Random) Nextf64n

func (rnd Random) Nextf64n(minVal float64, maxVal float64) float64

Nextf64n - Get the next random float64 number within the specified range

func (Random) Nexti16

func (rnd Random) Nexti16() int16

Nexti16 - Get the next random int16 number

func (Random) Nexti16n

func (rnd Random) Nexti16n(minVal int16, maxVal int16) int16

Nexti16n - Get the next random int16 number within the specified range.

func (Random) Nexti32

func (rnd Random) Nexti32() int32

Nexti32 - Get the next random int32 number

func (Random) Nexti32n

func (rnd Random) Nexti32n(minVal int32, maxVal int32) int32

Nexti32n - Get the next random int32 number within the specified range

func (Random) Nexti64

func (rnd Random) Nexti64() int64

Nexti64 - Get the next random int64 number

func (Random) Nexti64n

func (rnd Random) Nexti64n(minVal int64, maxVal int64) int64

Nexti64n - Get the next random int64 number within the specified range

func (Random) Nextu16

func (rnd Random) Nextu16() uint16

Nextu16 - Get the next random uint16 number

func (Random) Nextu16n

func (rnd Random) Nextu16n(minVal uint16, maxVal uint16) uint16

Nextu16n - Get the next random uint16 number within the specified range

func (Random) Nextu32

func (rnd Random) Nextu32() uint32

Nextu32 - Get the next random unt16 number

func (Random) Nextu32n

func (rnd Random) Nextu32n(minVal uint32, maxVal uint32) uint32

Nextu32n - Get the next random unt16 number within the specified range

func (Random) Nextu64

func (rnd Random) Nextu64() uint64

Nextu64 - Get the next random uint64 number

func (Random) Nextu64n

func (rnd Random) Nextu64n(minVal uint64, maxVal uint64) uint64

Nextu64n - Get the next random uint64 number within the specified range

Jump to

Keyboard shortcuts

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