帮助构建随机名称生成器
作为一名教师,我希望创建一个随机名称生成器以在我的课程中使用。我知道的不多,但我愿意学习。 我希望我的随机名称生成器能够从外部 csv 或 txt 文件加载类列表 - 我希望随机名称生成器能够识别时间并加载一天中该时间的预定义类。我认为如果日期和时间列在 csv 或 txt 文件中每个班级列表上方,效果最好。 我还将添加一个基本操作按钮,按下该按钮会生成新名称。 我看过一些帖子提到创建随机数生成器,然后将其链接到文本列表,但我认为我正在尝试做一些更不同的事情。 我正在 Vista SP2 上使用 Visual Studio Pro 2010(如果有帮助的话)。 干杯。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不反对使用 R(统计软件环境),我创建了一个名为 randomNames 的包,它会生成随机名称,可以根据性别和种族代码对这些名称进行概率采样。 http://cran.r-project.org/web/packages/randomNames/
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/
最简单的方法是编写一个基本 Windows GUI 应用程序。
第一步是读取文件。这个 链接 将帮助您了解阅读 CSV 的基础知识,如果您选择只做一个“格式”文件,其中第一行是日期,其余的是名称,您将无法利用该库,并且可能会只是最终手动解析文件。此链接将帮助您解决此问题.
将所有名称读入集合后< /a> 进行计数并创建一个随机数生成器并将最大数量设置为列表的长度。生成一组不同的随机数到一个单独的集合中。
** 另一种选择是使用类似 this 的内容,这是一个随机的排序方法
The easiest way to do this would be to write a basic windows gui app.
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.
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
When the button is clicked iterate through your random numbers list and return the name.