Stochastic modelling of star-formation histories II: star-formation variability from molecular clouds and gas inflow