Refactoring mruby-random