We study the influence of boundary conditions on self-affine random functions u(t) in the interval t/L ∈ [0, 1], with independent Gaussian Fourier modes of variance ∼ 1/q α . We consider the probability distribution of the mean square width of u(t) taken over the whole interval or in a window t/L ∈ [x, x + δ]. Its characteristic function can be expressed in terms of the spectrum of an infinite matrix. This distribution strongly depends on the boundary conditions of u(t) for finite δ, but we show that it is universal (independent of boundary conditions) in the small-window limit (δ → 0, δ ≪ min[x, 1 − x]). We compute it directly for all values of α, using, for α < 3, an asymptotic expansion formula that we derive. For α > 3, the limiting width distribution is independent of α. It corresponds to an infinite matrix with a single non-zero eigenvalue. We give the exact expression for the width distribution in this case. Our analysis facilitates the estimation of the roughness exponent from experimental data, in cases where the standard extrapolation method cannot be used.