Fixed bugs in randomGeneration, output