I am using Turing and would like to create some posterior predictive distributions. In order to do this, I need to sample from the posterior distribution. I am wondering what is the best way to sample a set of parameters from the MCMCChains object. Here is something that works:

```
using MCMCChains
n_iter = 500
n_name = 3
n_chain = 2
# experiment results
val = randn(n_iter, n_name, n_chain) .+ [1, 2, 3]'
val = hcat(val, rand(1:2, n_iter, 1, n_chain))
# construct a Chains object
chn = Chains(val)
function posteriorSample(chain)
parms = chain.name_map.parameters
idx = rand(1:length(chain))
return map(x->chain[x].value[idx],parms)
end
#sample from the chain
postSample = posteriorSample(chn)
```

However, I was wondering if there is (undocumented) built in functionality for sampling from the chain or a better approach.