In Numbers 31, God tells the Israelites to wipe out the Midianites (and incidentally, Balaam) by killing every male. But they spared certain women (v17-18):
Now therefore kill every male among the little ones, and kill every woman that hath known man by lying with him. But all the women children, that have not known man by lying with him, keep alive for yourselves.
Why did they spare these women (and not men who had not known women intimately)? And would this apply to women who may have been raped? How would they have told the difference, especially in a culture that may have been promiscuous?