Cython implementation of the Gillespie algorithm