|
-
Oct 11th, 2012, 01:24 PM
#1
Thread Starter
Addicted Member
How can I generate random alphanumeric codes?
Hi everyone,
I've been lurking here for a while doing a lot of reading before asking my first question (yes, I'm a noob). Also english is not my native language, so I hope I can explain myself properly.
Ok, my first question is: how can I generate, say 100 random alphanumeric codes that can also be validated later?
Some context: A friend and I have a small "home" brewery and for marketing purposes we're starting a "contest" (may not be the right word I'm looking for, as it's not a competition) where each bottle has one of these alphanumeric codes printed in the inner part of the top (the thing that keeps the bottle unopened, don't know the word). This alphanumeric code is then entered into a web app which validates it and then tells you if you entered a winning code, which earns you prizes like a free six-pack, 12-pack or others.
These alphanumeric codes would be about 8 to 10 characters long and would look something like this: "W4MP6HZS".
These 100 codes need to be generated only once and randomly, and I need to find a way to validate them once they're entered into the web app. I think I can handle most of the programming, but I want to ask you more experienced guys how would you do it (the code generating/validating part)?
Should I just generate 100 random codes, store them in a database and validate them checking if what's entered in the web app matches something in the database or is there a more efficient way to do this?
Cheers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|