Java Random Int randomInt(final int upToNotInclusive)

Here you can find the source of randomInt(final int upToNotInclusive)

Description

random Int

License

Open Source License

Declaration

public static int randomInt(final int upToNotInclusive) 

Method Source Code

//package com.java2s;

public class Main {
    public static int randomInt(final int upToNotInclusive) {
        final double rnd = Math.random() * upToNotInclusive;
        int ret = (int) Math.floor(rnd);
        if (ret == upToNotInclusive) {
            ret = 0;/*ww w .ja  v a2 s. c  o  m*/
        }
        return ret;
    }
}

Related

  1. randomHexOfInt(int min, int max)
  2. randomInIntervall(float low, float high)
  3. randomInt(double arg)
  4. randomInt(final int max)
  5. randomInt(final int min, final int max)
  6. randomInt(int ceil)
  7. randomInt(int fromInclusive, int toExclusive)
  8. randomInt(int in)
  9. randomInt(int low, int high)