List of usage examples for java.util Random Random
public Random()
From source file:Main.java
public static int generateRandomNumber(int max) { Random rand = new Random(); return rand.nextInt(max); }
From source file:Main.java
public static int generateAutomaticRoll() { Random random = new Random(); int low = 1;/*www . j a v a 2 s.co m*/ int high = 100; return random.nextInt(high - low) + low; }
From source file:Main.java
static int randomNumber(int first, int second) { Random r = new Random(); int bigger = Math.max(first, second); int smaller = Math.min(first, second); return r.nextInt(bigger - smaller + 1) + smaller; }
From source file:Main.java
public static String RandomTenThousand() { Random random = new Random(); int randNum = random.nextInt(9000) + 1000; return randNum + ""; }
From source file:Main.java
public static String generateRandom() { Random number = new Random(); StringBuilder message = new StringBuilder(); for (int i = 0; i < 1405; i++) { message.append('a' + number.nextInt(52)); }// w w w . j a v a 2 s. co m return message.toString(); }
From source file:Main.java
public static int getRandomInt(int min, int max) { Random r = new Random(); return r.nextInt(max - min + 1) + min; }
From source file:Main.java
public static int randInt(int min, int max) { Random random = new Random(); return random.nextInt((max - min) + 1) + min; }
From source file:Main.java
public static int randomNumber(int min, int max) { Random rand = new Random(); return rand.nextInt((max - min) + 1) + min; }
From source file:Main.java
public static String getRandom(int i) { Random jjj = new Random(); // int suiJiShu = jjj.nextInt(9); if (i == 0)//from w w w.jav a 2s . c o m return ""; String jj = ""; for (int k = 0; k < i; k++) { jj = jj + jjj.nextInt(9); } return jj; }
From source file:Main.java
public static String randomString() { Random generator = new Random(); StringBuilder randomStringBuilder = new StringBuilder(); char tempChar; for (int i = 0; i < 32; i++) { tempChar = (char) (generator.nextInt(25) + 97); randomStringBuilder.append(tempChar); }//from ww w. j a va 2 s . c o m return randomStringBuilder.toString(); }