Java Random Int getRandomIntBetween(int mi, int ma)

Here you can find the source of getRandomIntBetween(int mi, int ma)

Description

get Random Int Between

License

Open Source License

Declaration

public static int getRandomIntBetween(int mi, int ma) 

Method Source Code


//package com.java2s;
import java.util.*;

public class Main {
    static Random rm = new Random();

    public static int getRandomIntBetween(int mi, int ma) {
        int n = rm.nextInt();
        while (n < mi || n > ma) {
            n = rm.nextInt();/*from ww w  .jav a2s.c o m*/
        }
        return n;
    }
}

Related

  1. getRandomInt(int sek, int min, int max)
  2. getRandomInt(int size)
  3. getRandomInt(Random rand, int lower, int upper)
  4. getRandomInt(String level)
  5. getRandomIntBetween(int low, int high)
  6. getRandomInteger(int aStart, int aEnd)
  7. getRandomInteger(int min, int max)
  8. getRandomIntegerArray(Random rand, int size, int range)
  9. getRandomIntegerInRange(Random p_76136_0_, int p_76136_1_, int p_76136_2_)