Converted random functions to random class