code: def makeRandomBinaryTree(leafNodeNumber=None):
      
      while True:
          nodeNo = [-1]
          def fn():
              nodeNo[0] += 1
              if random.random() > 0.6:
                  i = str(nodeNo[0])
                  return BinaryTree(0.00001 + random.random()*0.8, True, fn(), fn(), i)
              else:
                  return BinaryTree(0.00001 + random.random()*0.8, False, None, None, str(nodeNo[0]))
          tree = fn()
          def fn2(tree):
              if tree.internal:
                  return fn2(tree.left) + fn2(tree.right)
              return 1
          if leafNodeNumber is None or fn2(tree) == leafNodeNumber:
              return tree
docs: Creates a random binary tree.