-2

I need a personal ID generator for Bulgarian IDs and since our IDs are 10 digits long I can't do it with an int number and I need some suggestions. I tried with this code but it doesn't work. It also needs to be above 999999999 or below 9999999999.

static class ID {
    Random random = new Random();
    long perID = random.nextLong(999999999);
}
Cristian
  • 654
  • 1
  • 13
  • 30
Brunny
  • 13
  • 4

1 Answers1

0
Random random = new Random();
long perID = (long) (random.nextDouble() * 1000000000) + 999999999L;
Tix
  • 610
  • 6
  • 16