Java Random getItemID(Random r)

Here you can find the source of getItemID(Random r)

Description

get Item ID

License

Open Source License

Declaration

public static int getItemID(Random r) 

Method Source Code

//package com.java2s;
//License from project: GNU General Public License 

import java.util.*;

public class Main {
    public static int getItemID(Random r) {
        return nonUniformRandom(8191, 1, 100000, r);
    }/* w ww. ja  v a  2  s .  c o m*/

    public static int nonUniformRandom(int x, int min, int max, Random r) {
        return (((randomNumber(0, x, r) | randomNumber(min, max, r)) + randomNumber(
                0, x, r)) % (max - min + 1)) + min;
    }

    public static int randomNumber(int min, int max, Random r) {
        return (int) (r.nextDouble() * (max - min + 1) + min);
    }
}

Related

  1. generateRandom(int length, int type)
  2. generateRandom(Integer bitNum)
  3. generateRandomIntegerId()
  4. generateRandomNo()
  5. GenerateRandomPin()
  6. getOreMultiplier(int fortune, Random r)
  7. getPoisson(double lambda, Random rng)
  8. getRandom()
  9. getRandom()