Analytic solution of the random Ising model in one dimension