small program for sampling from chi-square distribution