Randomly shuts off

Have you recently replaced the gas cap, it may need to be vented, or check the tank vent isn't plugged.

Next time it happens, loosen the gas cap, to let some air in, and see if it'll go.

cheers