We solve numerically both the deterministic stochastic Swift-Hohenberg equation [J. Swift and P. C. Hohenberg, Phys. Rev. A 15, 319 (1977)] in one spatial dimension. In the deterministic case we address the question of pattern selection by studying the temporal evolution away from a uniform, unstable solution. The asymptotic stationary solutions found are periodic in space with a range of wave numbers that is narrow, and consistent with earlier theoretical predictions on the range of allowable periodicities in a finite system. In the stochastic case, the power spectrum of the stationary solutions is very broad and typical configurations do not have a well-defined periodicity. A correlation length is defined that measures the extent over which a stationary solution is periodic. We find that the correlation length is finite, smaller than the size of the system studied and decreases with the amplitude of the stochastic contribution. We confirm these findings by performing a Monte Carlo heat-bath simulation that directly samples the stationary probability distribution function associated with the Lyapunov functional from which the Swift-Hohenberg equation is derived.