Java Random Int randInt(int range)

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

Description

rand Int

License

Open Source License

Declaration

public static int randInt(int range) 

Method Source Code

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

public class Main {
    public static int randInt(int range) {
        if (range < 1) {
            return 0;
        }/*w  w  w.  j  av  a  2 s.com*/
        return (int) (Math.random() * range);
    }

    public static int random(int min, int max) {
        return Math.round((float) Math.random() * (max - min)) + min;
    }
}

Related

  1. randInt(int min, int max)
  2. randInt(int min, int max)
  3. randInt(int n)
  4. randInt(int n)
  5. randInt(int n)
  6. randInt(int range)
  7. RandInt(int x, int y)
  8. randIntArray(int length)
  9. randIntArray(int length)