Random sampling utilities in C and Cython