Sortition seed selection

Where in the code can I find where the first seed is set up for sortition? If anyone can explain how that is done it would be very helpful.

Thanks

The first seed is the hash of the balance table in the genesis block.
See Section 3 of specs/Algorand_v1_spec-2.pdf at master · algorandfoundation/specs · GitHub