Praying while gambling without realizing it is done by most people but when they win or lose they forget it! I never pray when gambling because I am well aware that it is an act that is prohibited by my religion "lol
By the way, this applies not only to gambling (but of course it applies to them). When a person prays about some event and it happens, he quickly forgets about his prayer and the help of the Almighty. And he believes that it should be so. And so on until the next event and turning to prayer, then again forgets. And this sequence accompanies all conscious life.
But, yes, praying for winning a gambling game is wrong. Because this is a prayer for self-interest and is discouraged in most religions.