Fixed getRan() method