Jump to content
  • Advertisement
Sign in to follow this  
smlee

How to create random name using excel, VB or Access?

This topic is 3881 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i need some help over here. i wan to make a generator which can help me random pick a name. it is able to remove the name after it been used. i trying to make it for lucky draw.

Share this post


Link to post
Share on other sites
Advertisement
Why don't you just hard code a list of first (and/and-not last) names...keep a flag next to each saying if its been used or not, and pick randomly until you find an unflagged name? There is no upper bound on the running time but statistically should be completely negligible for this purpose, but if you wanted to be a stickler about it you could move each picked name to the back of the list and modulo your random number by the active size of the remaining names as you whittle it down..

Share this post


Link to post
Share on other sites
Since you just want to pick a random name,

Enter them all into a column in Excel, go into the VB editor and create a Subroutine.

In the subroutine you just need to get the number of columns in the listobject, get a random number in this range and use that to get your name (since you know the column and that will give you the row). Once you have the name, just swap that row with the last row and delete the last row. Easy stuff.

I'd give you code, but I'm pretty terrible at VB (since I use it about one day a year), and you can probably find a carbon copy program in ten seconds on Google.

Share this post


Link to post
Share on other sites
how to generate the name? do i use textbox to show the random name show up?

what will the scripting like if i wan to click on the run button to let the random run and pick a name for the winner?

i try putting random something but error.

Share this post


Link to post
Share on other sites
in excel, how can i move the selected winner to another column or row or delete the winner so i wont repeat the same person again?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!