Random List Generation and Array Handling

Well it looks like our Tuesday bloggers have let us down 🙁

Today’s lesson was to create a program to store 50 random number in an array and then to display that array in reverse. Once the task was given the pupils were asked to solve the problem. Most went straight to the computer and never thought about analysis or design, this led to confusion about the task and pupils were brought back and the task discussed again.

The Main steps were given to the pupil

  1. Set up variables
  2. Populate list with random numbers
  3. Create reverse list
  4. Display forward and reverse lists
  5. end program

After discussion we had the following refinements for step 2

  1. For 50 numbers
  2. Generate random whole number between 1 and 20
  3. Store number at next location in Array
  4. Next

In VB this is written as

For IntCounter = 1 to 50