r67: 2-pass sampling for low RAM