All-thermal transistor based on stochastic switching