Guest User

Untitled

a guest
Jul 17th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. import java.util.Random;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. RandomNumber user = new RandomNumber();
  6. String names = ["George", "Fred", "Jaxon", "Maddy", "Fredrick", "Amy", "Devin", "Connor", "Dylan", "Macncheese", "Predunce", "CattleDogMan", "Catman", "Jackson", "Mattie"];
  7. int random = user.createNum(0, 14);
  8. String user2 = names[random];
  9. System.out.println("Hello " + user2);
  10. }
  11. }
  12.  
  13. public class RandomNumber {
  14. public static createNum(min, max) {
  15. int firstnum = (Math.random() * max) + min;
  16. return firstnum;
  17. }
  18. }
  19.  
  20. public class Main {
  21.  
  22. public static void main(String[] args) {
  23. String[] names = {"George", "Fred", "Jaxon", "Maddy", "Fredrick", "Amy", "Devin", "Connor", "Dylan", "Macncheese", "Predunce", "CattleDogMan", "Catman", "Jackson", "Mattie"};
  24. int random = createNum(0, 14);
  25. String user2 = names[random];
  26. System.out.println("Hello " + user2);
  27. }
  28.  
  29. public static int createNum(int min, int max) {
  30. int firstnum = (int) ((Math.random() * max) + min);
  31. return firstnum;
  32. }
  33. }
Add Comment
Please, Sign In to add comment