By segulah I was referring to a source that brings down that it is permitted to test Hashem by promising to give maaser if Hashem will grant him financial profit.
I don’t remember at this moment where this source is.
Therefore, my question was if it is permitted to test Hashem in this way regarding lottery tickets.
Now that I understand your question better, here are a few points on this.
The idea of testing Hashem refers to a person’s giving maaser, not by making a deal with Hashem to give maaser in the future. Besides it means that the person will give masser from all of the person’s profits, not only from the lottery.
Additionally, the idea is that Hashem will make the person rich, it does not say that one can stipulate to Hashem exactly where the money must come from.
Also, the verse, this segula is based on says, that “the gates of Heaven will be opened”, which can also mean that the merit will be saved for a different use which is more important than money. For example, to save the person from a calamity that is supposed to befall him, divorce, illness or a death in the family, etc. the fortune, that he will merit from giving maser will be changed, for his benefit to the other more important “wealth”.
Also, if the person has certain aveiros, such as the aveiro of stealing, or engaging in shady business practices, the segula will not work, because it will only work, if the person doesn’t have aveiros that cause the person to lose money.