The API for this package was created based on Go's math/rand
package.
new
Rand.expFloat64
Rand.float32
Rand.float64
Rand.int
Rand.int31
Rand.int31n
Rand.int63
Rand.int63n
Rand.intn
Rand.normFloat64
Rand.seed
Rand.uint32
A Source
represents a source of uniformly-distributed pseudo-random int64 values in the range [0, 1<<63).
FYI: https://pkg.go.dev/math/rand#Source
A Rand
is a source of random numbers.
FYI: https://pkg.go.dev/math/rand#Rand
newSource
returns a new pseudo-random Source
seeded with the given value.
FYI: https://pkg.go.dev/math/rand#NewSource
newSource(seed int) Source
seed
: seed value
grpc.federation.rand.newSource(10)
int63
returns a non-negative pseudo-random 63-bit integer as an int64.
Source.int63() int
grpc.federation.rand.newSource(10).int63()
seed
uses the provided seed value to initialize the generator to a deterministic state.
Source.seed(seed int) bool
seed
: the seed value
Return value is always true
.
grpc.federation.rand.newSource(10).seed(20)
new
returns a new Rand
that uses random values from src
to generate other random values.
FYI: https://pkg.go.dev/math/rand#New
new(src Source) Rand
src
: source value for generates random values
grpc.federation.rand.new()
expFloat64
returns an exponentially distributed double type value in the range (0, max float64 value
) with an exponential distribution whose rate parameter (lambda) is 1 and whose mean is 1/lambda (1). To produce a distribution with a different rate parameter, callers can adjust the output using:
sample = grpc.federation.rand.new().expFloat64() / desiredRateParameter
FYI: https://pkg.go.dev/math/rand#Rand.ExpFloat64
Rand.expFloat64() double
grpc.federation.rand.new().expFloat64()
float32
returns a value as float type, a pseudo-random number in the half-open interval (0.0,1.0).
FYI: https://pkg.go.dev/math/rand#Rand.Float32
Rand.float32() float
grpc.federation.rand.new().float32()
float64
returns a value as double type, a pseudo-random number in the half-open interval (0.0,1.0).
FYI: https://pkg.go.dev/math/rand#Rand.Float64
Rand.float64() double
grpc.federation.rand.new().float64()
int
returns a non-negative pseudo-random int.
FYI: https://pkg.go.dev/math/rand#Rand.Int
Rand.int() int
grpc.federation.rand.new().int()
int31
returns a non-negative pseudo-random 31-bit integer as an int value.
FYI: https://pkg.go.dev/math/rand#Rand.Int31
Rand.int31() int
grpc.federation.rand.new().int31()
int31n
returns as an int type, a non-negative pseudo-random number in the half-open interval (0,n). It returns error if n <= 0.
FYI: https://pkg.go.dev/math/rand#Rand.Int31n
Rand.int31n(n int) int
n
: non-negative value
grpc.federation.rand.new().int31n(10)
int63
returns a non-negative pseudo-random 63-bit integer as an int64.
FYI: https://pkg.go.dev/math/rand#Rand.Int63
Rand.int63() int
grpc.federation.rand.new().int63()
int63n
returns as an int64 bit value, a non-negative pseudo-random number in the half-open interval [0,n). It panics if n <= 0.
FYI: https://pkg.go.dev/math/rand#Rand.Int63n
Rand.int63n(n int) int
grpc.federation.rand.new().int63n(10)
intn
returns, as an int, a non-negative pseudo-random number in the half-open interval [0,n). It panics if n <= 0.
FYI: https://pkg.go.dev/math/rand#Rand.Intn
Rand.intn(n int) int
grpc.federation.rand.new().intn(10)
normFloat64
returns a normally distributed double value in the range -<max double value>
through <max double value>
inclusive, with standard normal distribution (mean = 0, stddev = 1). To produce a different normal distribution, callers can adjust the output using:
sample = grpc.federation.rand.new().normFloat64() * desiredStdDev + desiredMean
FYI: https://pkg.go.dev/math/rand#Rand.NormFloat64
Rand.normFloat64() double
grpc.federation.rand.new().normFloat64()
seed
uses the provided seed value to initialize the generator to a deterministic state.
FYI: https://pkg.go.dev/math/rand#Rand.Seed
Rand.seed(seed int) bool
seed
: the seed value
grpc.federation.rand.new().seed(10)
uint32
returns a pseudo-random 32-bit value as a uint32.
FYI: https://pkg.go.dev/math/rand#Rand.Uint32
Rand.uint32() uint
grpc.federation.rand.new().uint32()