How might you implement a simple "coin-flip" game as an on-chain solana program?  

The concept is that a player deposits a coin or token and the smart contract generates a "win" or a "lose" with a 50/50 chance. On a win the game would payout the original coin and a winning amount and on a lose, the coin would be added to a pool. 


<sup>This question was previously asked but the text of [that question was edited significantly][1] so that it now asks something entirely different. The Q+A was reposted here to keep them in sync.</sup>

[1]:https://solana.stackexchange.com/questions/974/how-to-create-a-pda-and-enable-data-storage