It's not that it randomly shuts off, it's that the batteries drain incredibly quickly and the battery % indicator becomes inaccurate. I often see my 5 go from 60% to 40% to 15% to off in less than 60 seconds. The Apple site ran diags on my phone and confirmed the battery had reached "failure" status, but without AppleCare, the warranty only lasts 1 year and the service is nearly $100.
The iPhone 5 is sort of a reverse antenna-gate: instead of realizing how badly made the phone was at launch, we didn't realize it until the iPhone 5S was out, and nobody cares if the "old" model has issues.