Hi,
I've also got a Galaxy s5 g900f. It also randomly restarts and has been doing so ever since I bought it new, in early May. I have factory reseted my phone many, many times, tried it in safe mode, tried it using only Samsung provided applications, tried it with and without the sd card (which also happens to be Samsung). No luck, it just keeps restarting.
Samsung made me send it three times to a repair centre (since May), which found nothing wrong with the phone. They told me that that proved my phone was alright and that the problem was surely something with the software. They also asked me (for like the millionth time) if I had tried a factory reset...
I flashed Exodus (a custom rom) to my phone, thinking that that might be the solution (I know that may void the warranty but the issue is moot in my case, since Samsung assures me my phone is fine). In any case, Exodus custom rom and all, the phone keeps randomly restarting. The custom rom is otherwise nice looking, fast, and in my case, absolutely useless.
None of the solutions I've seen offered around on the internet was any good for my particular handset. Hope you guys have better luck. The phone costed me 400 Swiss francs, and is going to a recycle centre pretty soon.