Replace the random function by rand, which helps us no more depend on statistic package, I also convert Windows ending style to Unix ending style