A treap maintains two properties:
BST property: for every node, left subtree keys < node key < right subtree keys
Heap property: for every node, node priority > children priorities These properties uniquely determine the tree structure given keys and priorities. If you assign random priorities, the resulting tree is equivalent to a BST built by inserting keys in random order. Random order insertion gives expected height. The treap achieves this without actual randomization of insert order.