views:

132

answers:

1

Hi all, As a teacher I am looking to create a random name generator to use with my classes. I don't know much but I am willing to learn. I want my random name generator to be able to load class lists from an external csv or txt file - I want the random name generator to be able to recognise the time and load the pre-defined class for that time of day. I think this will work best if the day and time were listed above each class list in the csv or txt file. I will also look to add a basic action button which generates a new name when pressed. I have seen some posts referring to creating a random number generator and then link this to a text list but I think I am trying to do something a bit more different. I am using Visual Studio Pro 2010 on Vista SP2 if that helps. Cheers.

A: 

The easiest way to do this would be to write a basic windows gui app.

  1. First Step is to read the file. This link will help you with the basics of reading CSV, if you choose to just do a "format" file where first line is date and then the rest is names you wont be able to leverage that library and will probably just end up parsing the file manually. This link will help you out with that.

  2. Once you have read all names into a collection take the count and create a Random number generator and set the max number to the length of your list. Generate a distinct set of random numbers into a separate collection.

    ** Another option is to use something like this, which is a random sort method

  3. When the button is clicked iterate through your random numbers list and return the name.

Nix
Thank you for your answer Nix - I am looking into this and will keep all updated.
Steve