Sampling with strict energy constraints