Fixed way index value is generated

Fixed potential error in getRandomFood ();