Both the dice rolls for the 2nd-level School of Divination Wizard class feature Portent and a Wizard's spell preparation occur "when you finish a long rest". Which comes first - or can a Wizard PC choose?
The specific problem here is that if Portent's dice rolls happen before spell choice, the PC might choose different spells. If not, they cannot use that information when they make spell choices.
(PHB, p. 114)
You can change your list of prepared spells when you finish a long rest. Preparing a new list of wizard spells requires time spent studying your spellbook and memorizing the incantations and gestures you must make to cast the spell: at least 1 minute per spell level for each spell on your list.
(PHB, p. 116)
Portent. Starting at 2nd level when you choose this school, glimpses of the future begin to press in on your awareness. When you finish a long rest, roll two d20s and record the numbers rolled.