Update class.php

Added random function