speedup distribution sampling eliminating atomic access
Merge branch 'master' into mac