Randomly generate a name or a code machine

Source: Internet
Author: User

/*
* Random phrase generation machine
*/
public class Pharse {
public static void Main (string[] args) {
Feel free to add characters
String[] Wordlistone = {
"Three", "group", "the", "I", "Oh", "hot", "ear", "Low", "Ann"
};
String[] Wordlistthree = {
"Three", "no", "see", "Fly", "\ \ (^o^)/~", "first", "ear", "low", "with"
};
String[] Wordlisttwo = {
"Dog", "group", "See", "Fly", "Oh", "first", "Yes", "low", "speed"
};


Calculate how many terms each group has
int onelength = Wordlistone.length;
int twolength = Wordlisttwo.length;
int threelength = Wordlistthree.length;

Generate random numbers
int rand1 = (int) (Math.random () *onelength);
int rand2 = (int) (Math.random () *twolength);
int rand3 = (int) (Math.random () *threelength);

Combine the terms
String phrase = Wordlistone[rand1] + "" + Wordlisttwo[rand2] + "" +wordlistthree[rand3];

Output
System.out.println (phrase);


}
}

Randomly generate a name or a code machine

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.