We study Chebyshev-polynomial expansion of the inverse localization length of Hermitian and non-Hermitian random chains as a function of energy. For Hermitian models, the expansion produces this energy-dependent function numerically in one run of the algorithm. This is in strong contrast to the standard transfer-matrix method, which produces the inverse localization length for a fixed energy in each run. For non-Hermitian models, as in the transfer-matrix method, our algorithm computes the inverse localization length for a fixed (complex) energy. We also find a formula of the Chebyshev-polynomial expansion of the density of states of non-Hermitian models. As explained in detail, our algorithm for non-Hermitian models may be the only available efficient algorithm for finding the density of states of models with interactions.