This is most likely caused by either a bad camshaft position sensor, or a bad crankshaft position sensor. If it is the cam position sensor; there will be no trigger pulses to the fuel injectors
at the time when it won't start; (but you have to be careful about testing this; because there will be trigger pulses at the injectors when it does start). There is an inexpensive tool called a "noid light" which is sold at many parts stores. This tool clips onto the injector wiring, and flashes a light when there are trigger pulses.
If the problem is the crankshaft position sensor; there will be no spark at the plugs when it doesn't start; but here again; there will be sparks at the plugs when it starts.
If it is caused by a fuel supply problem; it is MUCH more likely to be caused by a defective fuel pump wiring harness than by a bad pump. Countless perfectly good fuel pumps have been trashed because of the GM fuel pump wiring harness problem. So I recommend buying and installing a new fuel pump wiring harness from a good parts store before assuming the pump is bad. It will cost MUCH less than a new pump. And don't forget to also replace the fuel filter.
A cracked distributor rotor or distributor cap, or bad plug wires, or worn spark plugs can also cause such problems.