Generation of runaway electrons and X rays in an inhomogeneous electric field at high gas pressures