static String createUniqueSymbol(CNode node, String basis) {
        Set<String> usedSymbols = Arrays.stream(node.getChildren()).map(CNode::getName).collect(Collectors.toSet());
        Random rng = new Random();

        for (int i = 1;; i++) {
            String candidate = (i < basis.length()) ? basis.substring(0, i)
                    : ReservedWords.INTERNAL_PREFIX + basis + rng.nextInt(Integer.MAX_VALUE);
            if ( ! usedSymbols.contains(candidate)) {
                return candidate;
            }
        }
    }
@Test
    void testCreateUniqueSymbol() {
        final String testDefinition =
                "namespace=test\n" + //
                        "m int\n" + //
                        "n int\n";
        InnerCNode root = new DefParser("test", new StringReader(testDefinition)).getTree();

        assertEquals("f", createUniqueSymbol(root, "foo"));
        assertEquals("na", createUniqueSymbol(root, "name"));
        assertTrue(createUniqueSymbol(root, "m").startsWith(ReservedWords.INTERNAL_PREFIX + "m"));

        // The basis string is not a legal return value, even if unique, to avoid
        // multiple symbols with the same name if the same basis string is given twice.
        assertTrue(createUniqueSymbol(root, "my").startsWith(ReservedWords.INTERNAL_PREFIX + "my"));
    }