Asalaamu Alaikum,
I'm in a hurry, but I just had to reply to this.
It's in the verse -
And if any of your slaves ask for a deed in writing (to enable them to earn their freedom for a certain sum), give them such a deed if ye know any good in them: yea, give them something yourselves out of the means which God has given to you.
Islam (from my understanding) is the only Religion to do this, freeing a Slave is one thing (but it's pointless if their going to be on the streets left to die or end up being captured by someone else), thus the Master has to pay them and give them a good opportunity to live their own life.
Maybe this may explain what is meant by random -
"The law of slavery in the legal sense of the term is now obsolete. While it had any meaning, Islam made the slave's lot as easy as possible. A slave, male or female, could ask for conditional manumission by a written deed fixing the amount required for manumission and allowing the slave meanwhile to earn money by lawful means and perhaps marry and bring up a family. Such a deed was not to be refused if the request was genuine and the slave had character. Not only that, but the master is directed to help with money out of his own resources in order to enable the slave to earn his or her own liberty."
Now you might say "the slave may be overworked" into winning their freedom back? -
Abu Huraira reported Allah's Messenger (may peace be upon him) as saying:
"When the slave of anyone amongst you prepares food for him and he serves him after having sat close to (and undergoing the hardship of) heat and smoke, he should make him (the slave) sit along with him and make him eat (along with him), and if the food seems to run short, then he should spare some portion for him (from his own share) - (another narrator) Dawud said:" i. e. a morsel or two". 4097. (Translation of Sahih Muslim, The Book of Oaths (Kitab Al-Aiman), Book 015, Number 4096)"
Narrated Al-Ma'rur: "At Ar-Rabadha I met Abu Dhar who was wearing a cloak, and his slave, too, was wearing a similar one. I asked about the reason for it. He replied, "I abused a person by calling his mother with bad names." The Prophet said to me, 'O Abu Dhar! Did you abuse him by calling his mother with bad names You still have some characteristics of ignorance. Your slaves are your brothers and Allah has put them under your command. So whoever has a brother under his command should feed him of what he eats and dress him of what he wears. Do not ask them (slaves) to do things beyond their capacity (power) and if you do so, then help them.' (Translation of Sahih Bukhari, Belief, Volume 1, Book 2, Number 29)"
Narrated Anas: "The Prophet said, 'None of you will have faith till he wishes for his (Muslim) brother [this includes slaves, since a slave is considered a brother as shown above] what he likes for himself.' (Translation of Sahih Bukhari, Belief, Volume 1, Book 2, Number 12)"
Narrated Abu Musa Al-Ash'ari:
"The Prophet said, "Give food to the hungry, pay a visit to the sick and release (set free) the one in captivity (by paying his ransom)." (Translation of Sahih Bukhari, Food, Meals, Volume 7, Book 65, Number 286)"
"Zadhan reported that Ibn Umar called his slave and he found the marks (of beating) upon his back. He said to him: I have caused you pain. He said: No. But he (Ibn Umar) said: You are free. He then took hold of something from the earth and said: There is no reward for me even to the weight equal to it. I heard Allah's Messenger (may peace be upon him) as saying: He who beats a slave without cognizable offence of his or slaps him, then expiation for it is that he should set him free. (Translation of Sahih Muslim, The Book of Oaths (Kitab Al-Aiman), Book 015, Number 4079)"
Interesting how even the smallest of things warrents a slave to be set free, this was 1400 years ago when people (as the Bible suggest) would beat their slaves to an inch of their life.
This may interest you aswell -
First, it is important to know that thousands of years ago life was different than today. Today, people wouldn't accept slavery for any reason. The reason for this is because people are a lot more independent both financially, education wise, mentally, etc... But people back then were different. When a tribe or a group of people lose a major battle and their money is mostly, if not all, is taken as war booty by the other side, then people could and would accept being slaves for the following reasons:
1- Both financial and social security. When their country or tribe lost the war, they also lost most or all of their money as war booty. Being out of money and food, it becomes necessary for an individual to find the means for basic survival in life. Living as a slave would provide this.
2- Protection from hostile individuals. Even under the Islamic rule, you can still find hostile individuals who violate the Law and take matters into their own hands. An enemy family can be sometime in danger if they don't have a "protector".
3- Widows, Orphans, and the extremely poor of the enemy side need the financial and social protection from a Master. Back then, there were no governments with good social system that protects everyone. Slavery back then was that social system in special cases.
What was notably different from the slavery of the western world, however, was the degree to which they [slaves] were protected by Muslim law. When the law was observed, their treatment was good. They might expect to marry and have families of their own, and they had a good chance of being freed. There were also built in avenues of escape.
Gwyn Campbell; Frank Cass, The Structure of Slavery in Indian Ocean Africa and Asia, 2004
Really doubt you can argue against the fact that Islam did discourage Slavery, never in the Quran was it mentioned in positive light to have slaves, yet everywhere theres mentions of freeing slaves and treating them well.