helper

package
v0.0.101 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	LETTER_IDX_BYTES = 6                       // 6 bits to represent a letter index
	LETTER_IDX_MASK  = 1<<LETTER_IDX_BYTES - 1 // All 1-bits, as many as LETTER_IDX_BYTES
	LETTER_IDX_MAX   = 63 / LETTER_IDX_BYTES   // # of letter indices fitting in 63 bits
)
View Source
const LETTER_BYTES = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

Variables

This section is empty.

Functions

func ByteCountIEC

func ByteCountIEC(b int64) string

ByteCountIEC convert the byte in input to MB/KB/TB ecc

func ByteCountSI

func ByteCountSI(b int64) string

ByteCountSI convert the byte in input to MB/KB/TB ecc

func ConvertSize added in v0.0.18

func ConvertSize(bytes float64, dimension string) float64

ConvertSize is delegated to return the dimension related to the input byte size

func GenerateSequentialArray added in v0.0.101

func GenerateSequentialArray[T types.Number](length int) []T

GenerateSequentialArray is delegated to generate an array of sequential number

func Marshal added in v0.0.43

func Marshal(data interface{}) string

func MarshalIndent added in v0.0.43

func MarshalIndent(data interface{}) string

func RandomByte added in v0.0.41

func RandomByte(length int) []byte

RandomByte is delegated to generate a byte array with the given input length

func RandomFloat32 added in v0.0.14

func RandomFloat32(min, max float32) float32

RandomFloat32 initialize a new seed using the UNIX Nano time and return a float32 between the 2 input value

func RandomFloat64 added in v0.0.14

func RandomFloat64(min, max float64) float64

RandomFloat64 initialize a new seed using the UNIX Nano time and return a float64 between the 2 input value

func RandomInt added in v0.0.2

func RandomInt(min, max int) int

RandomInt initialize a new seed using the UNIX Nano time and return an integer between the 2 input value

func RandomInt32 added in v0.0.14

func RandomInt32(min, max int32) int32

RandomInt32 initialize a new seed using the UNIX Nano time and return an integer between the 2 input value

func RandomInt64 added in v0.0.14

func RandomInt64(min, max int64) int64

RandomInt64 initialize a new seed using the UNIX Nano time and return an integer between the 2 input value

Types

type RandomGenerator added in v0.0.14

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

RandomGenerator is delegated to generate random without call seed every time

func InitRandomizer added in v0.0.14

func InitRandomizer() RandomGenerator

InitRandomizer initialize a new RandomGenerator

func (RandomGenerator) RandomFloat32 added in v0.0.14

func (rander RandomGenerator) RandomFloat32(min, max float32) float32

RandomFloat32 initialize a new seed using the UNIX Nano time and return a float32 between the 2 input value

func (RandomGenerator) RandomFloat32Array added in v0.0.14

func (rander RandomGenerator) RandomFloat32Array(min, max float32, length int) []float32

RandomFloat32Array return a new array with random number from min to max of length len

func (RandomGenerator) RandomFloat64 added in v0.0.14

func (rander RandomGenerator) RandomFloat64(min, max float64) float64

RandomFloat64 initialize a new seed using the UNIX Nano time and return a float64 between the 2 input value

func (RandomGenerator) RandomFloat64Array added in v0.0.14

func (rander RandomGenerator) RandomFloat64Array(min, max float64, length int) []float64

RandomFloat64Array return a new array with random number from min to max of length len

func (RandomGenerator) RandomInt added in v0.0.14

func (rander RandomGenerator) RandomInt(min, max int) int

RandomInt initialize a new seed using the UNIX Nano time and return an integer between the 2 input value

func (RandomGenerator) RandomInt32 added in v0.0.14

func (rander RandomGenerator) RandomInt32(min, max int32) int32

RandomInt32 initialize a new seed using the UNIX Nano time and return an integer between the 2 input value

func (RandomGenerator) RandomInt32Array added in v0.0.14

func (rander RandomGenerator) RandomInt32Array(min, max int32, length int) []int32

RandomInt32Array return a new array with random number from min to max of length len

func (RandomGenerator) RandomInt64 added in v0.0.14

func (rander RandomGenerator) RandomInt64(min, max int64) int64

RandomInt64 initialize a new seed using the UNIX Nano time and return an integer between the 2 input value

func (RandomGenerator) RandomInt64Array added in v0.0.14

func (rander RandomGenerator) RandomInt64Array(min, max int64, length int) []int64

RandomInt64Array return a new array with random number from min to max of length len

func (RandomGenerator) RandomIntArray added in v0.0.14

func (rander RandomGenerator) RandomIntArray(min, max, length int) []int

RandomIntArray return a new array with random number from min to max of length len

func (RandomGenerator) RandomString added in v0.0.71

func (rander RandomGenerator) RandomString(n int) string

Jump to

Keyboard shortcuts

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