Application of random codes to the gathering of statistical information