main.swift318 chars8 lines
In the code above, we first initialize the sum to 0. Then, we use a for loop to generate a random number between 1 and 6 for 20 times, adding each roll to the sum. We also print the roll for each iteration. Finally, we print the total sum after all rolls are done.
gistlibby LogSnag