Lab 7.1 - Random Number Stack

Dice Stack by Hiebl Markus,

Remember that calculator lab we refactored? We're going to do it again!!

Just kidding.

The real lab is about random numbers. As has been previously mentioned, computers don't really do random numbers. What they have is a bunch of random numbers in a big list. It takes off a number every time it is needed.

Write a program that generates one hundred random numbers (integers between 1 and 20 inclusive, or 0 and 19 if you're feeling clever) and stores them in an array. The array should be displayed in a ListBox, with the data formatted thusly:

0:        5
1:        18
2:        12
3:        4
4:        9

When the user clicks a Button, a number of things happen. The current 0th member of the array is displayed in a nice big Label. Then, the zeroth element is removed, and elements 1 through 99 are shifted one place toward zero (walk the array to do this). Then, a new random number is generated and stored in the 99th position. Finally, the new array is displayed in the list box (don't forget to clear the list box first).

HINTS: For the number shift, you'll need to figure out an algotithm that traverses the array, copying values from element (n) to element (n - 1). Start out by designing in pseudocode (I'm not kidding).

As always, design a useful and proper interface.