How to generate unique ID that is integer in java that not guess next number?
How unique does it need to be?
If it's only unique within a process, then you can use an AtomicInteger and call incrementAndGet() each time you need a new value.
AtomicInteger
incrementAndGet()
1.4m articles
1.4m replys
5 comments
57.0k users