def to_unit

unified-nsga-iii@0.2.2.0 · rng.bend:44

import unified-nsga-iii@0.2.2.0/rng.bend as Rng
import Base

44# Top 24 bits / 2^24 so the F32 mantissa is exact and the value is in [0, 1).
45def to_unit(u: U32) -> F32:
46  F32.div(U32.to_f32(U32.shrn(u, 8n)), 16777216.0)

Uses (5)

Used by (1)