cpu based implementation of gillespie algorithm