Java ThreadLocalRandom getRandomInt(int n)

Here you can find the source of getRandomInt(int n)

Description

get Random Int

License

Apache License

Declaration

public static int getRandomInt(int n) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.concurrent.ThreadLocalRandom;

public class Main {
    public static int getRandomInt(int n) {
        return getThreadLocalRandom().nextInt(n);
    }//from w  w w .  j av  a  2  s  .c  o m

    public static ThreadLocalRandom getThreadLocalRandom() {
        return ThreadLocalRandom.current();
    }
}

Related

  1. getRandomFloat()
  2. getRandomId(@Nonnull Random random, int length)
  3. getRandomInt()
  4. getRandomInt(int a, int b)
  5. getRandomInt(int limit)
  6. getRandomInt(int r)
  7. getRandomInteger()
  8. getRandomIntegerElement(List list)
  9. getRandomNumbers(Integer startNumber, Integer endNumber, Integer pageSize, Integer numNumbers)