user2300: Is it possible to generate a random number in Plutus on-chain code? For example, if I would like to implement a smart contract that works like gambling game, where a person deposits ADA and bets on a random outcome and then the contract generates that random outcome to determine if the player won?

user1130: 
Is it possible to generate a random number in Plutus on-chain code?

No. On-chain code is deterministic, so there is no way to generate a number on-chian that someone off-chain couldn't predict.
The way around this would be to use an RNG oracle. Essentially outsourcing the generation of the random number to some third party, off-chain. You can then use that oracle's (or multiple oracles') data as an input for any games that needs random values.

2300: <p>Is it possible to generate a random number in Plutus on-chain code? For example, if I would like to implement a smart contract that works like gambling game, where a person deposits ADA and bets on a random outcome and then the contract generates that random outcome to determine if the player won?</p>
 1130: <blockquote>
<p>Is it possible to generate a random number in Plutus on-chain code?</p>
</blockquote>
<p>No. On-chain code is deterministic, so there is no way to generate a number on-chian that someone off-chain couldn't predict.</p>
<p>The way around this would be to use an RNG oracle. Essentially outsourcing the generation of the random number to some third party, off-chain. You can then use that oracle's (or multiple oracles') data as an input for any games that needs random values.</p>
