randomdouble implementation tweaks