Java Random Int randInt(int n)

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

Description

Returns a pseudorandom integer sampled uniformly from {0, ..., n-1} Assumes n > 0

License

Open Source License

Declaration

public static int randInt(int n) 

Method Source Code

//package com.java2s;

import java.util.Random;

public class Main {
    private static Random rand;

    /**//from www . j ava  2 s. c  o m
     * Returns a pseudorandom integer sampled uniformly from {0, ..., n-1} Assumes
     * n > 0
     */
    public static int randInt(int n) {
        return rand.nextInt(n);
    }
}

Related

  1. randInt(int min, int max)
  2. randInt(int min, int max)
  3. randInt(int min, int max)
  4. randInt(int min, int max)
  5. randInt(int min, int max)
  6. randInt(int n)
  7. randInt(int n)
  8. randInt(int range)
  9. randInt(int range)