math

package
v0.0.0-...-07e1736 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(n int64) int64

Abs implement the abs function according to http://cavaliercoder.com/blog/optimized-abs-for-int64-in-go.html

func IsFinite

func IsFinite(f float64) bool

IsFinite reports whether f is neither NaN nor an infinity.

func StrLenOfInt64Fast

func StrLenOfInt64Fast(x int64) int

StrLenOfInt64Fast efficiently calculate the string character lengths of an int64 as input

func StrLenOfUint64Fast

func StrLenOfUint64Fast(x uint64) int

StrLenOfUint64Fast efficiently calculate the string character lengths of an uint64 as input

Types

type MysqlRng

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

MysqlRng is random number generator and this implementation is ported from MySQL. See https://github.com/tikv/tikv/pull/6117#issuecomment-562489078.

func NewWithSeed

func NewWithSeed(seed int64) *MysqlRng

NewWithSeed create a rng with random seed.

func NewWithTime

func NewWithTime() *MysqlRng

NewWithTime create a rng with time stamp.

func (*MysqlRng) Gen

func (rng *MysqlRng) Gen() float64

Gen will generate random number.

func (*MysqlRng) SetSeed1

func (rng *MysqlRng) SetSeed1(seed uint32)

SetSeed1 is a interface to set seed1

func (*MysqlRng) SetSeed2

func (rng *MysqlRng) SetSeed2(seed uint32)

SetSeed2 is a interface to set seed2

Jump to

Keyboard shortcuts

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