move random number generator to class method and variable