The function "Generate random AID" should be improved.
It should check the existing AIDs in that node to avoid that two AIDs share the same prefix. (This also means that if you have the nodes 0...F in the node, you cannot generate a random AID under that node)
Not only the root node (aid:) should have this functionality.
The function "Generate random AID" should be improved.