It is used when the number of repetitions is not known in advance. This program is complex but built out of fairly simple component parts. The UK national lottery requires six balls numbered between 1 and 49 to be selected. Duplicate numbers are not allowed. The numbers are displayed in ascending order after the lottery draw.
Simulate dice throws.
Count how many times each number comes up. Design a suitable screen display. This could show the count as numbers or percentages or bars on a bar chart. This program shows how to do a time delay using a Delphi System timer. When you press the button, after five seconds, the word Hello appears.