Algorithm Implementation/Pseudorandom Numbers/Chi-Square Test

VB.NET
The following is a program to calculate the chi-square value for N positive integers less than r.