One-dimensional disordered Ising models by replica and cavity methods.