Factored sampling