We perform a computational study of a variant of the ``train'' model for earthquakes [PRA 46, 6288 (1992)], where we assume a static friction that is a stochastic function of position rather than being velocity dependent. The model consists of an array of blocks coupled by springs, with the forces between neighbouring blocks balanced by static friction. We calculate the probability, P(s), of the occurrence of avalanches with a size s or greater, finding that our results are consistent with the phenomenology and also with previous models which exhibit a power law over a wide range. We show that the train model may be mapped onto a stochastic sandpile model and study a variant of the latter for non-spherical grains. We show that, in this case, the model has critical behaviour only for grains with large aspect ratio, as was already shown in experiments with real ricepiles. We also demonstrate a way to introduce randomness in a physically motivated manner into the model.