Stochastic model

Hello, I trained myseldf with the SIR parameter inference tutoirial, and I have a question: how to turn the model stochastic, ie the transitions between compartiments are a value drawn from a probability distribution? how to change the code?

thanks a lot