Fixed integer overflow and incorrect output with overly large sample sizes.