use equivalent formulation for masking out sign bit in rand functions