add to_continuous to calc_state, genrand still a problem