Added rand function
Added random when no priorities in jail