On a random entanglement problem