You should test if the $id is equal to the $randomId.