improved rand generator