Fixed the incorrect random function