I am  not sure of the reason for this. Perhaps just take the entire range 1..maxNodeId and pick random node ids from this range?