I hate to ask this, because I'm asking someone to do my work for me. Could someone help me write a fast binomial random number generator?
I have written this:
function X = binom(N,p)
X = sum(rand(1,N)<p);
which is about 3x faster than the built-in vectorized version.
I would like to write a compiled c version, but I basically know nothing about c.