I don't know if you can differentiate between gambling and investing in real life. Both activities involve making bets with certain payoff and certain probability in mind.
It's often really difficult to know the actual risk you were exposed to and whether your probability assessments were reasonably accurate.