SPIDER: a Bioinspired Swarm Algorithm for Adaptive Risk-Taking