开发者

Help building a random name generator

开发者 https://www.devze.com 2023-01-09 05:18 出处:网络
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.

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 r开发者_运维知识库andom 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.


If you are not averse to using R, the statistical software environment, I created a package called randomNames that produces random names that can be probabilistically sampled based upon gender and ethnicity codes. http://cran.r-project.org/web/packages/randomNames/


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消