Patchy distribution of flexible genetic elements in bacterial populations mediates robustness to environmental uncertainty.