God gave Job everything that he had according to His sovereign pleasure. And because God is sovereign, He does according to His own good pleasure. He gives to the devil a degree of power in order that God's purpose and counsel might be accomplished also by the devil. He gives to men a certain power in order that through them He might accomplish His purpose. But God is the primary cause behind everything.
Nothing is by chance or by fate.
Everything is perfectly governed by God. And God does so perfectly, maintaining His holiness and righteousness, so He cannot be accused to be the author of evil. That sovereignty of God is clearly taught in God's Word, and here in the book of Job. Job confesses that God is the One who gives all things-good and evil. God was not finished with Job.