I have this small program that simulates dice rolls using random numbers. It does 1 million rolls and outputs the results for 1, 10, 100....., 1000000. The way my code is structured right, the program starts by outputting the results for 1 roll, then does 9 other rolls and outputs the results again. I would like to make it so all the rolls are done before outputting anything, because right now I'm basically stopping every loop to check if a condition is met or not and I believe this is somewhat unrecommended. How could I make it so the output code is outside the random loop ?