Exact electronic spectra and inverse localization lengths in one-dimensional random systems: I. Random alloy, liquid metal and liquid alloy