The Phrase Generator (Short) (Java).
- September 10th, 2011
- Posted in Code
- By Lettergram
- Write comment
And I present to you a simple phrase generator:
public class PhraseMaker {
public static void main(String[] args) {
String [] WordListOne = {"Students","Schools","People",
"Stoners","We","Computers","Professors"};
String [] WordListTwo = {"share","embody","value",
"speak of","enjoy","enable","strike"};
String [] WordListThree = {"sex!","studying.",
"perfection!", "gold.","my body.","it dirty
"};
int oneLength = WordListOne.length;
int twoLength = WordListTwo.length;
int threeLength = WordListThree.length;
int rand1 = (int) (Math.random() * oneLength);
int rand2 = (int) (Math.random() * twoLength);
int rand3 = (int) (Math.random() * threeLength);
String phrase = WordListOne[rand1] + " " +
WordListTwo[rand2] + " " + WordListThree[rand3];
System.out.println (phrase);
}}
Result:
Any number of combinations made from the three lists above. I would add more, but I feel I have gone as far as I wish to go, if anyone wishes to add, feel free.
First time I run the program this is what pops out:
Schools value sex!
No comments yet.