fix output of sampling
add tests for distribution