Java Random Int randLocation(int min, int max)

Here you can find the source of randLocation(int min, int max)

Description

rand Location

License

Apache License

Declaration

public static int randLocation(int min, int max) 

Method Source Code

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

public class Main {
    public static int randLocation(int min, int max) {
        double rand = Math.random();
        int temp = (int) ((rand * (max - min)) + min);

        if (((int) (rand * 1000) % 2) == 0) {
            temp *= -1;//w ww.j a  va2s  .c o  m
        }

        return temp;
    }
}

Related

  1. randInt(int range)
  2. RandInt(int x, int y)
  3. randIntArray(int length)
  4. randIntArray(int length)
  5. randIntv(double fr, double to)
  6. Random(int a, boolean Zero)
  7. random(int length)
  8. random(int length)
  9. random(int length, String data)