Optimal Equalization of Discrete Signals Passed Through a Random Channel