Génération de 10 chiffres nombre aléatoire unique en Java

Je suis en train d'essayer avec code ci-dessous pour générer les 10 chiffres du nombre aléatoire unique. Comme pour mon req-je créer autour de 5000 numéros uniques(ids). Cela ne fonctionne pas comme prévu. Il génère également -cinq numéros. Aussi, parfois, un ou deux chiffres sont manquants dans le numéro généré résultant en 8 ou 9 numéros non 10.

public static synchronized  List generateRandomPin(){

    int START =1000000000;
    //int END = Integer.parseInt("9999999999");
    //long END = Integer.parseInt("9999999999");
    long END = 9999999999L;

    Random random = new Random();

    for (int idx = 1; idx <= 3000; ++idx){
        createRandomInteger(START, END, random);
    }

    return null;
}


private static void createRandomInteger(int aStart, long aEnd, Random aRandom){
    if ( aStart > aEnd ) {
      throw new IllegalArgumentException("Start cannot exceed End.");
    }
    //get the range, casting to long to avoid overflow problems
    long range = (long)aEnd - (long)aStart + 1;
    logger.info("range>>>>>>>>>>>"+range);
    //compute a fraction of the range, 0 <= frac < range
    long fraction = (long)(range * aRandom.nextDouble());
    logger.info("fraction>>>>>>>>>>>>>>>>>>>>"+fraction);
    int randomNumber =  (int)(fraction + aStart);    
    logger.info("Generated : " + randomNumber);

  }

source d'informationauteur RajaShanmugam