refactored randomizer functions