Java ThreadLocalRandom getRandomInt(int a, int b)

Here you can find the source of getRandomInt(int a, int b)

Description

get Random Int

License

Open Source License

Declaration

public static int getRandomInt(int a, int b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.ThreadLocalRandom;

public class Main {
    public static int getRandomInt(int a, int b) {
        if (a == b)
            return a;
        if (a > b)
            return ThreadLocalRandom.current().nextInt(b, a);
        return ThreadLocalRandom.current().nextInt(a, b);
    }/* w w  w.ja va  2s  . c  o m*/
}

Related

  1. getRandomElement(E[] array)
  2. getRandomElement(List elements)
  3. getRandomFloat()
  4. getRandomId(@Nonnull Random random, int length)
  5. getRandomInt()
  6. getRandomInt(int limit)
  7. getRandomInt(int n)
  8. getRandomInt(int r)
  9. getRandomInteger()