fixed random() method