refactoring module Random