refactoring random