Fix non working code in random() method.