code for scientific random sampling and apps