changes to rand func