A general-purpose Monte Carlo particle transport code based on inverse transform sampling for radiotherapy dose calculation