  Non-Gaussian distributions are commonly observed in collisionless space
plasmas. Generating samples from non-Gaussian distributions is critical for the
initialization of particle-in-cell simulations that investigate their driven
and undriven dynamics. To this end, we report a computationally efficient,
robust tool, Chebsampling, to sample general distribution functions in one and
two dimensions. This tool is based on inverse transform sampling with function
approximation by Chebyshev polynomials. We demonstrate practical uses of
Chebsampling through sampling typical distribution functions in space plasmas.
