fshift
Shifts the elements of an array by a (possibly non-integer) given number of elements.
Author: Francois Bouffard
I had to remove the following from the function: "if isreal(x); y = real(y); end;". With this gone, the output of the fft() of a complex exponential is exactly equal to an fshift()ed sinc().
Code can be made faster by vectorizing the while loop, and also to return multiple draws from the distribution. Just make sure to validate your modifications with a non-symmetric distribution like a beta.