Abraham had told a half truth to Abimelech, the ruler of the Philistines, deceiving him about the relationship between Abraham and Sarah, but later Abraham and Abimelech made a covenant, showing that they had worked things out (Genesis 21.27).
As part of that covenant, watch what Abraham did and his explanation of his actions,
“And Abraham set seven ewe lambs of the flock by themselves. Then Abimelech asked Abraham, ‘What is the meaning of these seven ewe lambs which you have set by themselves?’ And he said, ‘You will take these seven ewe lambs from my hand, that they may be my witness that I have dug this well'” (Genesis 21.28–30).
We would have asked the same thing. Why these ewe lambs, and why seven?
Abraham explained that they were his witness that he had dug a well that was under dispute.
Therefore, the number was not random, but more than demonstrated his honesty, integrity, and full intention of dealing with Abimelech in righteousness from that point on!