Numerical computation of Thomson scattering spectra for non-Maxwellian or anisotropic electron distribution functions