Having casual sex may actually be good for you, according to a new study published in the journal Social Psychology and Personality Science.

Researchers from New York University and Cornell University surveyed for the study 371 college students. In their responses, 42 percent admitted to having sex outside of a relationship.

The study found sociosexually unrestricted students -- that is, those who slept around -- reported higher well-being after casual sex. The researchers found lower stress and higher thriving following casual sex, "suggesting that high sociosexuality may both buffer against any potentially harmful consequences of casual sex and allow access to its potential benefits."

All this is even more interesting considering the same researcher, Zhana Vrangalova, Ph.D. of Cornell, wrote just a few months ago that casual sex makes you depressed.

So what's the difference? It appears the difference depends on the motivation for casual sex.

The motivations were divided between "right" reasons, as autonomous, or "wrong" ones, as nonautonomous. Autonomous was for reasons like wanting the fun and enjoyment, or "to explore and learn about your sexuality." Nonautonomous included doing it for revenge, to feel better about yourself, avoid unpleasant feelings or "being somehow tricked or coerced into it, or too intoxicated to make a responsible decision."

"I found that whether or not students hooked up during the course of the year was not related to their well-being at the end of the year," Vrangalova previously wrote. "However, whether they did it for nonautonomous motives was." Autonomous motivation, meanwhile, was unrelated to well-being.