English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

as example: i wanna make a card the same idea as the mobile prepaid cards or bank prepaid cards but for other business & i wanna know how to get the script or the application program that makes the random number logarethem to put it inside my website & when the customer scrach the card & add the no.s in the website the website accept it & let 'em pass to buy as example !plz who got a solution send me it ! thanks alot

2006-07-28 11:41:56 · 1 answers · asked by moo_designz 2 in Computers & Internet Programming & Design

1 answers

This is super simple.

Here is the code in JSP

String random_string = "";
String alpha_char = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
String num_char = "1234567890";
int alpha_num_choice, alpha_choice, num_choice;

for (int i=0; i<10; i++) {
alpha_num_choice = (int) (Math.random() * 2);
if (alpha_num_choice == 0) {
alpha_choice = (int) (Math.random() * 52);
random_string = random_string + alpha_char.charAt(alpha_choice);
} else {
num_choice = (int) (Math.random() * 10);
random_string = random_string + num_char.charAt(num_choice);
}
}

Basically, what the codes above do is to randomly pick a number and then get a character at that position. I am a web developer myself. If you have any questions, please let me know.

2006-07-28 11:50:09 · answer #1 · answered by knitting guy 6 · 3 0

fedest.com, questions and answers