All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
What you are doing (what you mentioned in the question) is not permissible because it is forbidden gharar (deceit) and forbidden gambling.
An-Nawawi said:
“The prohibition of the sale in which there is gharar is one of the principles of the sharee'ah under which many issues are classified.
Among the conditions for the validity of the sale is that the sold item must be known. You have mentioned that the sold item is unknown, as well as the gift which is related to it. Even if there is gharar just in one of them, it is enough to make this forbidden because the gift is related to the goods and because the price is paid for them both; therefore, the sold item must be known as well as the gift. Imaam Ahmad said in a narration by Muhanna, 'If a man is given a dress in order to sell it, and he did so, and the buyer gave him a handkerchief as a gift, then the handkerchief is for the owner of the dress.' Ibn Qudaamah while commenting on this, said, 'Imaam Ahmad said this because the gift of the handkerchief resulted from the sale, so the handkerchief is an increase in the price, and an increase in the price in the meeting of the contract is added to the price.'”
If the sold item becomes known and the gift becomes known, then it is permissible. Muhammad Zakariyyah At-Tahhaan said in his book about contests and prizes, “Their ruling in the Islamic sharee'ah is that there is no difference of opinion among the contemporary jurists that the apparent (known) gift that is related to the goods is permissible because the gift is considered as a decrease in its price.”
Allaah knows best.