Java Random Int RandInt(int x, int y)

Here you can find the source of RandInt(int x, int y)

Description

Rand Int

License

Open Source License

Declaration

static public int RandInt(int x, int y) 

Method Source Code


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

import java.util.Random;

public class Main {
    static private Random rand = new Random();

    static public int RandInt(int x, int y) {
        assert y >= x : "<RandInt>: y is less than x";
        return rand.nextInt() % (y - x + 1) + x;
    }/*from   www  . ja v  a  2 s .c om*/
}

Related

  1. randInt(int n)
  2. randInt(int n)
  3. randInt(int n)
  4. randInt(int range)
  5. randInt(int range)
  6. randIntArray(int length)
  7. randIntArray(int length)
  8. randIntv(double fr, double to)
  9. randLocation(int min, int max)