When speaking of God's sovereignty, like many, I sometimes forget about God's restraining power over sin. The Reformed position is that God's omniscience is based on his decree (Isaiah 46:10). That is that God knows all things because He has so ordered them to be that way. What happens in space and time happens because God's decree gives form to the whole of history. People often object that this makes us robots, and that the Reformed understanding of God's sovereignty impinges on human free will. What people often overlook is the fact that God's sovereignty actually restrains the sinful hearts of men and brings about His own good purposes. The story of Joseph and his brothers in Genesis serves to illustrate the sovereign power of God to restrain human freedom that produces evil.
"When they saw him from a distance and before he came close to them, they plotted against him to put him to death. They said to one another, "Here comes this dreamer! "Now then, come and let us kill him and throw him into one of the pits; and we will say, 'A wild beast devoured him.' Then let us see what will become of his dreams!" But Reuben heard this and rescued him out of their hands and said, "Let us not take his life." Reuben further said to them, "Shed no blood. Throw him into this pit that is in the wilderness, but do not lay hands on him"--that he might rescue him out of their hands, to restore him to his father.- Genesis 37:18-22
Joseph's brothers were dead set on taking Joseph's life. Reuben steps in (maybe for selfish reasons) to save his brothers life, but despite Reuben's plea, the rest of his brothers still want to kill him. Showing the depths of the depravity of man's fallen condition Judah says "...What profit is it for us to kill our brother and cover up his blood? "Come and let us sell him to the Ishmaelites and not lay our hands on him, for he is our brother, our own flesh," And his brothers listened to him"(Genesis 37:26-27). The brothers of Joseph opt to not kill Joseph simply in virtue of practical convenience. Trying to be somewhat rational Judah feigns some familial emotions to cover up his motives by saying "he is our brother after all." It is vital to point out that the original intention of Joseph's brothers was to kill Joseph. The brothers then changed their minds and Joseph was sold into slavery, and not killed. But this happened not simply because of the sinful whims of man. This happened because God had a purpose in Joseph being sold into slavery: "Now, therefore, it was not you who sent me here, but God..." (Genesis 45:8), "As for you, you meant evil against me, but God meant it for good in order to bring about this present result, to preserve many people alive."(Genesis 50:20). Keep in my mind that the text doesn't say that God used what the brothers did and then turned it into good. In one action we have God's good intentions and the evil intentions of the brothers. The brothers were not robots, they acted on their own sinful desires. God didn't hold a gun to their head, they did what they desired. God's decree and purpose are what kept the brothers from carrying out the more sinful action of murdering Joseph. God's sovereignty restrains the freedom of the fallen sinner. But how can this work on a system centered around man's free will? The answer is simple, it doesn't work because free will doesn't exist for man, but for God it does exist. The brothers did not have the freedom to do other than what God had decreed. If God hadn't decreed that Joseph would be sold into slavery, and He let them do what their free will desired, then Joseph would have been murdered by his brothers.
Another example earlier in the book of Genesis shows God's freedom to order events as he pleases for His good purposes. In Genesis 20 Abraham lies to Abimelech by telling him that Sarah was his sister, as a result Abimelech takes Sarah. V.7, God speaking to Abimilech, "Then God said to him in the dream, "Yes, I know that in the integrity of your heart you have done this, and I also kept you from sinning against Me; therefore I did not let you touch her." Again the question needs to be asked, if Abimelech had free will then why did God not let Abimelech sin against Him and touch Sarah? The answer is obvious, God purposed to preserve the relationship of Abraham and Sarah by restraining the evil of Abimelech. God's will is what stands, not the freedom of the rebellious sinner.
The doctrine of God's sovereignty has huge implications for how we view evil and mans freedom. God's sovereignty is a good thing for it serves to restrain the evil that mankind wants to carry out. If evil is happening outside of God's decree then it means that purposeless evil is happening throughout the world. Evil has a purpose because God has a decree to bring about his will through it. Is there any comfort in the idea that God doesn't want evil to happen and yet it still does? The Christian can have comfort in God's sovereign hand for He is "...working all things after the counsel of His will" (Ephesian 1:11). This is why all things have purpose, because God is bringing His will to pass. God isn't letting things happen because man's freedom is so important, and then getting His purposes out of them later. He isn't the great cosmic reactor.