bend-collections
Releases (1)
-
1.0.0.0 indexed
Definitions (4,483)
src/math/random/rand.bend
- def retryfuel rejection steps (an accepted draw is a fixed point of step)
- def result
- def lemire_smalllo >= n >= t accepts at once; otherwise t = 2^64 mod n is computed and at most 127 more draws are made
- def lemire_first
- def uint64n_pick
- def uint64nuniform in [0, n) for n > 0 (Go's Uint64N)
- def uint_below
- def lo32
- def uint32nuniform in [0, n) for n > 0 (Go's Uint32N)
- def w_gothe 32-bit word of the low 8k bits of n, a byte at a time
- def skipn div 2^(8k)
- def nat64the 64-bit word of n < 2^64
- def to_nat
- def intn_z
- def intnuniform in [0, n) for 0 < n < 2^48 (Go's IntN); (0, s) for n == 0
- def plus
- def int_rangeuniform in [lo, hi) for lo < hi, hi - lo < 2^48; (lo, s) when hi <= lo
- def f53x >> 11 as a double divided by 2^53: for m = x >> 11 > 0 with c leading zeros (11 <= c <= 63), m << (c - 11) has its top bit at 52, and the value m 2^-53 is that significand with biased exponent 1033 - c (below 1023)
- def f53_z
- def to_floatGo's Float64: float64(x << 11 >> 11) / (1 << 53), the low 53 bits
- def float_of
- def float64
- def nth
- def put
- def swap_m
- def swapexchange elements i and j (unchanged when either is out of range)
- def swap_at
- def len64the length as a 64-bit word
- def shuffle_stepswap element i with a uniform j < n = i + 1
- def shuffle_goi = k, k - 1, ..., 1 with the bound n = i + 1 as a 64-bit word
- def shuffleGo's Shuffle (Fisher-Yates, from the last index down), for fewer than 2^48 elements
- def range_go
- def range[0, 1, ..., n - 1]
- def permGo's Perm: a shuffle of 0..n-1
src/math/u64.bend
- type U64
- def zero
- def of_u32
- def is_zero
- def carry
- def add_fin
- def addWrapping 64-bit addition.
- def neg_fin
- def negTwo's-complement negation.
- def order
- def le_sign
- def le_signeda <= b as signed 64-bit integers.
- def div_finLong division in 32/12/12/8-bit digits: every partial remainder is below d <= 2^20, so each candidate r * 2^12 + digit stays below 2^32.
- def div_t3
- def div_t2
- def div_smallUnsigned a / d, for 0 < d <= 2^20.
- def div_sign
- def div_small_signedSigned a / d truncated toward zero (C semantics), for 0 < d <= 2^20.
src/math/w64.bend
- def lo
- def hi
- def b32
- def mk
- def of32
- def is_zero
- def lt
- def le
- def eq
- def add_fin
- def add
- def add_over_fin
- def add_overa + b >= 2^64
- def suba - b mod 2^64
- def half
- def odd
- def mul32_fin
- def mul32_mid
- def mul32_h
- def mul32the full product of two U32
- def mula * b mod 2^64
- def mul_over_one
- def mul_overa * b >= 2^64
- def dig_tOne digit of the long division by d: (r * base + g) / d and mod d, for a remainder r < d < 2^32 and a digit g < base = 2^16, so every partial dividend r * 2^16 + g is below 2^48 (the runtime's Nat bound).
- def dig1
- def dig2
- def div32_fin
- def div32_t1
- def div32(a / d, a mod d) for d > 0: the high word natively, the low word by digits
- def mod_step
- def mod32a mod d for d > 0
- def pow22^k for k < 32
- def bl_pick
- def bl_step
- def bl_fin
- def bitlenthe number of bits of x (0 for 0), by a binary search on the top bit
- def shl_lt
- def shl_ge
- def shl_pick
- def shla << k mod 2^64 for k < 64
- def shr_lt
- def shr_ge
- def shr_pick
- def shra >> k (0 for k >= 64)
- def fst_q
- def snd_r
- def q_clamp_z
- def q_clampmin(q, 2^32 - 1)