revise random functions