With the amount of money I have spent whiles gambling and haven't won any major jackpot, I am not going to be donating anything to any charitable cause unless I have made a huge profits and to my mind most people view money from gambling as dirty so I doubt any charity will be thrilled to have them.
Donating money is solely based on your will only, actually if you feel not giving money, you can always do it because its all yours.
Winning in a lottery you will not receive the full amount as most countries charge tax on the lottery winning and I believe one of the purpose of the government own lottery is to provide the needs of the charity through donation and actually even if you don't win, by just buying ticket, you are already making donations, so there is no sense to donate at all if you agree with my explanation.