Refactor Random class