def drop_k
import bendtorch@1.3.0.0/main.bend as Bendtorchimport Base
1243# the factor of number i: 1 / (1 - p) if its uniform u = (h >> 8) / 2^24 is >= p, else 0
1244def drop_k(+key: U32, +i: U32, +p: F32, +scale: F32) -> F32:
1245 pick(F32.is_lt((U32.to_f32(U32.shrn(mix32((key + i : U32)), 8n)) / 16777216.0 : F32), p), 0.0, scale)