### Question:
CellId implements NodeProtoId, Serializable { public ExportId randomExportId(String suggestedId) { String prefix = suggestedId; int ind = prefix.indexOf('@'); if (ind >= 0) { prefix = prefix.substring(0, ind + 1); } else { prefix = prefix + '@'; } Random random = new Random(); for (;;) { int suffix = random.nextInt() & 0x3FFFFFFF; String s = prefix + suffix; synchronized (this) { if (newExportId(s, false) == null) { return newExportId(s, true); } } } } CellId(LibId libId, CellName cellName, int cellIndex); IdManager getIdManager(); int numUsagesIn(); CellUsage getUsageIn(int i); int numUsagesOf(); CellUsage getUsageOf(int i); CellUsage getUsageIn(CellId protoId); int numExportIds(); ExportId getPortId(int chronIndex); ExportId newPortId(String externalId); ExportId randomExportId(String suggestedId); int newNodeId(); int newArcId(); Cell inDatabase(EDatabase database); String toString(); boolean isIcon(); boolean isSchematic(); static void main(String[] args); static final CellId[] NULL_ARRAY; final IdManager idManager; final LibId libId; final CellName cellName; final int cellIndex; }### Answer:
@Test public void testRandomExportId() { System.out.println("randomExportId"); String suggestedId = "A"; CellId instance = cellId1; assertEquals(1, instance.numExportIds()); ExportId result = instance.randomExportId(suggestedId); assertNotSame(e1_A, result); assertEquals(2, instance.numExportIds()); assertSame(instance.getPortId(1), result); assertTrue(result.externalId.startsWith("A@")); int numCopies = 100000; for (int i = 0; i < numCopies; i++) { instance.randomExportId(suggestedId); } assertEquals(numCopies + 2, instance.numExportIds()); idManager.checkInvariants(); }