java sets unique random number code example Example: java random unique number String id = UUID.randomUUID().toString();