Improved output and added random sampling method