Documentation ¶
Index ¶
- func BoolP(counter *sltype.Uint2, key uint32, p float32) bool
- func CounterAdd(counter *sltype.Uint2, inc uint32)
- func CounterIncr(counter *sltype.Uint2)
- func Float(counter *sltype.Uint2, key uint32) float32
- func Float11(counter *sltype.Uint2, key uint32) float32
- func Float112(counter *sltype.Uint2, key uint32) sltype.Float2
- func Float2(counter *sltype.Uint2, key uint32) sltype.Float2
- func MulHiLo64(a, b uint32) (lo, hi uint32)
- func NormFloat(counter *sltype.Uint2, key uint32) float32
- func NormFloat2(counter *sltype.Uint2, key uint32) sltype.Float2
- func Philox2x32(counter sltype.Uint2, key uint32) sltype.Uint2
- func Philox2x32bumpkey(key *uint32)
- func Philox2x32round(counter *sltype.Uint2, key uint32)
- func SincosPi(x float32) (s, c float32)
- func Uint2(counter *sltype.Uint2, key uint32) sltype.Uint2
- func Uint2ToFloat(val sltype.Uint2) sltype.Float2
- func Uint2ToFloat11(val sltype.Uint2) sltype.Float2
- func Uint32(counter *sltype.Uint2, key uint32) uint32
- func Uint32ToFloat(val uint32) float32
- func Uint32ToFloat11(val uint32) float32
- func Uintn(counter *sltype.Uint2, key uint32, n uint32) uint32
- type Counter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CounterAdd ¶
CounterAdd adds the given increment to the counter
func CounterIncr ¶
CounterIncr increments the given counter as if it was a uint64 integer.
func Float ¶
Float returns a uniformly-distributed 32 float in range (0,1) based on given counter and key. The counter is incremented by 1 (in a 64-bit equivalent manner) as a result of this call, ensuring that the next call will produce the next random number in the sequence. The key should be the unique index of the element being updated.
func Float11 ¶
Float11 returns a uniformly-distributed 32 float in range [-1,1] based on given counter and key. The counter is incremented by 1 (in a 64-bit equivalent manner) as a result of this call, ensuring that the next call will produce the next random number in the sequence. The key should be the unique index of the element being updated.
func Float112 ¶
Float112 returns two uniformly-distributed 32 floats in range [-1,1] based on given counter and key. The counter is incremented by 1 (in a 64-bit equivalent manner) as a result of this call, ensuring that the next call will produce the next random number in the sequence. The key should be the unique index of the element being updated.
func Float2 ¶
Float2 returns two uniformly-distributed 32 floats in range (0,1) based on given counter and key. The counter is incremented by 1 (in a 64-bit equivalent manner) as a result of this call, ensuring that the next call will produce the next random number in the sequence. The key should be the unique index of the element being updated.
func NormFloat ¶
NormFloat returns a random 32 bit floating number distributed according to the normal, Gaussian distribution with zero mean and unit variance.
func NormFloat2 ¶
NormFloat2 returns two random 32 bit floating numbers distributed according to the normal, Gaussian distribution with zero mean and unit variance. This is done very efficiently using the Box-Muller algorithm that consumes two random 32 bit uint32 values.
func Philox2x32 ¶
Philox2x32 implements the stateless counter-based RNG algorithm returning a random number as 2 uint3232 32 bit values, given a counter and key input that determine the result.
func Philox2x32bumpkey ¶
func Philox2x32bumpkey(key *uint32)
Philox2x32bumpkey does one round of updating of the key
func Philox2x32round ¶
Philox2x32round does one round of updating of the counter
func Uint2 ¶
Uint2 returns two uniformly-distributed 32 unsigned integers, based on given counter and key. The counter is incremented by 1 (in a 64-bit equivalent manner) as a result of this call, ensuring that the next call will produce the next random numberin the sequence. The key should be the unique index of the element being updated.
func Uint2ToFloat ¶
Uint2ToFloat converts two uint32 32 bit integers (Uint2) into two corresponding 32 bit float values (float2) in the (0,1) interval (i.e., exclusive of 1).
func Uint2ToFloat11 ¶
Uint2ToFloat11 converts two uint32 32 bit integers (Uint2) into two corresponding 32 bit float values (float2) in the (0,1) interval (i.e., exclusive of 1).
func Uint32 ¶
Uint32 returns a uniformly-distributed 32 unsigned integer, based on given counter and key. The counter is incremented by 1 (in a 64-bit equivalent manner) as a result of this call, ensuring that the next call will produce the next random number in the sequence. The key should be the unique index of the element being updated.
func Uint32ToFloat ¶
Uint32ToFloat converts a uint32 32 bit integer into a 32 bit float in the (0,1) interval (i.e., exclusive of 0 and 1). This differs from the Go standard by excluding 0, which is handy for passing directly to Log function, and from the reference Philox code by excluding 1 which is in the Go standard and most other standard RNGs.
func Uint32ToFloat11 ¶
Uint32ToFloat11 converts a uint32 32 bit integer into a 32 bit float in the [1,1] interval (inclusive of -1 and 1, never identically == 0)