If you read into Job you'll realise that another purpose was to develop Job's faith in him, and that it wasn't actually God that tortured Job, but Satan that did so.
God is entirely reasonable and not only that, but also merciful (not giving us what we deserve) and gracious (blessing us with...