first version that generates posterior samples