Java Random Number getNumberClose(int seed)

Here you can find the source of getNumberClose(int seed)

Description

get Number Close

License

Apache License

Declaration

private static int getNumberClose(int seed) 

Method Source Code

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

public class Main {
    private static java.util.Random ran = new java.util.Random();

    private static int getNumberClose(int seed) {
        if (seed == 0) {
            return 0;
        }//ww w  .  j a  va 2s  .c  om
        return getNumber() % (seed + 1);
    }

    private static int getNumberClose(int start, int end) {
        return start + getNumberClose(end - start);
    }

    private static long getNumberClose(long seed) {
        if (seed <= 0) {
            return 0;
        }
        return getNumberLong() % (seed + 1);
    }

    /**************************************************************/

    private static int getNumber() {
        return Math.abs(ran.nextInt());
    }

    private static int getNumber(int seed) {
        if (seed == 0) {
            return 0;
        }
        return getNumber() % seed;
    }

    private static int getNumber(int start, int end) {
        return start + getNumber(end - start);
    }

    private static long getNumberLong() {
        return Math.abs(ran.nextLong());
    }
}

Related

  1. getNumber(int _nX0, int _nX1)
  2. getNumber(int length)
  3. getNumber(int length)
  4. getNumber(int length)
  5. getNumber(int seed)
  6. getNumberedUsername(String fn, String ln)
  7. getNumberInRange(int minimum, int maximum)
  8. getNumberLong()
  9. getNumbers()