Robin Williams was the king of improvisation thanks to his standup background. In Good Will Hunting he tells Matt Damon’s character a story about his departed wife, who’d had bowel issues, sometimes broke wind, and once even woke herself up.
Williams invented this whole story on the go. By the way, not only Damon was laughing: you can notice that the image shakes a bit — it’s the cameraman giggling too.