Variety Is the Spice of Life: Irrational Behavior as Adaptation to Stochastic Environments