Generating reproducible IDs with UUID?
java
Solution
You can use `UUID.nameUUIDFromBytes(byte[] bytes)` where you get `byte[] bytes` from a `Random` or `SecureRandom` that you seeded
Problem
I'm using `UUID.randomUUID().getLeastSignificantBits();` to generate unique IDs. However I want to generate the same IDs every time I run the application in order to debug my code. How can I do that? Edit: thanks to zim-zam I created this class that solves the problem. ``` public class IDGenerator { private static Random random = new Random(1); public static long getID() { long id; byte[] array = new byte[16]; random.nextBytes(array); id = UUID.nameUUIDFromBytes( array ).getLeastSignificantBits(); return id; } } ```