udwRand

package
v0.0.0-...-f254aa5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 13 Imported by: 14

Documentation

Index

Constants

View Source
const ReadableAlphaNumMap = "23456789abcdefghjkmnpqrstuvwxyz"

Variables

This section is empty.

Functions

func ChooseOneInStringSlice

func ChooseOneInStringSlice(sList []string) string

func CryptoRandUint64NotZero

func CryptoRandUint64NotZero() uint64

func EncodeReadableAlphaNumForRand

func EncodeReadableAlphaNumForRand(b []byte) string

func EncodeReadableAlphaNumForRandNoAlloc

func EncodeReadableAlphaNumForRandNoAlloc(b []byte, tmpBuf []byte) string

func Float32

func Float32() float32

func Float64

func Float64() float64

func Float64Between

func Float64Between(min float64, max float64) float64

func GetRandOneInStringSlice

func GetRandOneInStringSlice(sList []string) string

func HappendBaseOnPossibility

func HappendBaseOnPossibility(possibility float64) bool

func Int63Between

func Int63Between(min int64, max int64) int64

func IntBetween

func IntBetween(min int, max int) int

func IntSliceBetween

func IntSliceBetween(start int, end int, size int) []int

func Intn

func Intn(num int) (out int)

func MustCryptoRandBytes

func MustCryptoRandBytes(length int) []byte

func MustCryptoRandBytesWithBuf

func MustCryptoRandBytesWithBuf(buf []byte)

func MustCryptoRandFromByteList

func MustCryptoRandFromByteList(length int, list string) string

func MustCryptoRandFromByteListNoAlloc

func MustCryptoRandFromByteListNoAlloc(length int, list string, tmpBuf []byte) []byte

func MustCryptoRandFromRandomContent

func MustCryptoRandFromRandomContent(randomContent []byte, list string) string

func MustCryptoRandToAlphaNum

func MustCryptoRandToAlphaNum(length int) string

func MustCryptoRandToHex

func MustCryptoRandToHex(length int) string

func MustCryptoRandToNum

func MustCryptoRandToNum(length int) string

func MustCryptoRandToNumWithRandomContent

func MustCryptoRandToNumWithRandomContent(randomContent []byte) string

func MustCryptoRandToReadableAlpha

func MustCryptoRandToReadableAlpha(length int) string

func MustCryptoRandToReadableAlphaNum

func MustCryptoRandToReadableAlphaNum(length int) string

func MustCryptoRandToReadableAlphaNumNoAlloc

func MustCryptoRandToReadableAlphaNumNoAlloc(length int, tmpBuf []byte) []byte

func MustCryptoRandUint16

func MustCryptoRandUint16() uint16

func MustCryptoRandUint64

func MustCryptoRandUint64() uint64

func MustCryptoRandUint64NotZero

func MustCryptoRandUint64NotZero() uint64

func MustPermInterfaceSlice

func MustPermInterfaceSlice(obj interface{}) (output interface{})

func MustPermInterfaceSliceInPlace

func MustPermInterfaceSliceInPlace(obj interface{})

func NewCryptSeedMathRand

func NewCryptSeedMathRand() (r *mrand.Rand)

func Perm

func Perm(num int) (out []int)

func PermFromCacheNoAlloc

func PermFromCacheNoAlloc(cache []int, start int, end int, output []int)

func PermNoAlloc

func PermNoAlloc(randomIndexArray []int)

func PermStringSlice

func PermStringSlice(slice []string) (output []string)

func PermStringSliceAndReturnPart

func PermStringSliceAndReturnPart(slice []string, partLen int) (output []string)

func RandRunOneFromFuncList

func RandRunOneFromFuncList(funList []func())

func RandUint64FromUint64

func RandUint64FromUint64(srcPort uint64) uint64

func TimeDurationBetween

func TimeDurationBetween(min time.Duration, max time.Duration) time.Duration

Types

type CombinatoricsRandom2d

type CombinatoricsRandom2d struct {
	ANumList     []int
	BNumList     []int
	ValidCombine [][]bool
	Output       []udwMath.IntVector2
}

func (*CombinatoricsRandom2d) Random

func (c *CombinatoricsRandom2d) Random(r *UdwRand) (err error)

type LcgTransformer

type LcgTransformer struct {
	Start uint64
	Range uint64
	A     uint64
	C     uint64
}

func (LcgTransformer) Generate

func (t LcgTransformer) Generate(i uint64) (output uint64)

func (LcgTransformer) GenerateInRange

func (t LcgTransformer) GenerateInRange(i uint64) (output uint64)

type PossibilityWeightRander

type PossibilityWeightRander struct {
	SearchList []float64
	Total      float64
}

func NewPossibilityWeightRander

func NewPossibilityWeightRander(weightList []float64) PossibilityWeightRander

func (PossibilityWeightRander) ChoiceOne

func (p PossibilityWeightRander) ChoiceOne(r *UdwRand) (Index int)

type PossibilityWeightRanderV2

type PossibilityWeightRanderV2 struct {
	SearchList []float64
	Total      float64
	ResultList []string
}

func NewPossibilityWeightRanderV2

func NewPossibilityWeightRanderV2(resultWeightMap map[string]float64) PossibilityWeightRanderV2

func (PossibilityWeightRanderV2) ChoiceOne

func (p PossibilityWeightRanderV2) ChoiceOne(r *UdwRand) (result string)

type UdwRand

type UdwRand struct {
	*mrand.Rand
	// contains filtered or unexported fields
}

func MustNewCryptSeedUdwRand

func MustNewCryptSeedUdwRand() (r *UdwRand)

func NewInt64SeedUdwRand

func NewInt64SeedUdwRand(seed int64) (r *UdwRand)

func (*UdwRand) ChoiceFromIntSlice

func (r *UdwRand) ChoiceFromIntSlice(slice []int) int

func (*UdwRand) Float32

func (r *UdwRand) Float32() float32

func (*UdwRand) Float64

func (r *UdwRand) Float64() float64

func (*UdwRand) Float64Between

func (r *UdwRand) Float64Between(min float64, max float64) float64

func (*UdwRand) HappendBaseOnPossibility

func (r *UdwRand) HappendBaseOnPossibility(possibility float64) bool

func (*UdwRand) Int63Between

func (r *UdwRand) Int63Between(min int64, max int64) int64

func (*UdwRand) IntBetween

func (r *UdwRand) IntBetween(min int, max int) int

func (*UdwRand) Intn

func (r *UdwRand) Intn(n int) int

func (*UdwRand) MulitChoice

func (r *UdwRand) MulitChoice(totalLength int, choiceNumber int) []int

func (*UdwRand) MulitChoiceOriginOrder

func (r *UdwRand) MulitChoiceOriginOrder(n int, size int) []int

func (*UdwRand) Perm

func (r *UdwRand) Perm(n int) []int

func (*UdwRand) PermIntSlice

func (r *UdwRand) PermIntSlice(slice []int) (output []int)

func (*UdwRand) PermNoAllocNoLock

func (r *UdwRand) PermNoAllocNoLock(randomIndexArray []int)

func (*UdwRand) ShuffleIntArrayNoAllocNoLock

func (r *UdwRand) ShuffleIntArrayNoAllocNoLock(arr []int, ShuffleNum int)

func (*UdwRand) TimeDurationBetween

func (r *UdwRand) TimeDurationBetween(min time.Duration, max time.Duration) time.Duration

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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