"Eye Rays. The beholder shoots three of the following magical eye rays
at random (reroll duplicates), choosing one to three targets it can
see within 120 feet of it"
It's funny what they did with the beholder. In the 4e, it could choose the targets and eyes on its turn but not on each player's turn, when it would attack them with a random eye.
From what I understand, at random, and since it's not a recharge power, I'd say the beholder is trying to focus some of its enemies while there are always rays going around in the dungeon room. The beholder is dangerous because it can always attack its enemies from any angle, but sometimes, its death ray is on the back of its head (each eye has a different spell, not more than one) and it can't use it against the fighter on its left or against the sorcerer in front of it. It will use its closest eye in that particular split second during battle, which is represented by dice roll (remember the characters are always moving during combat, looking around, repositioning and all that). That's why it's so random. I'd choose the targets first, as normally is done when you make an attack roll, and then roll a d10 to know what eye the Beholder is using.
You have to agree with me that, if you choose the targets after you know what eyes to use, the logic behind the way the beholder behaves and the fact it attacks with random rays falls apart and, besides, if you get 3 death rays in a row and use it against the same target over and over, it doesn't really feel random at all.
Beholders were always kinda unpredictable and I think the way described above applies to that idea very well.
Break it down with how a turn works
If you wanna go word by word, purely rules-wise, then just remember how a turn works.
First, you declare what you're about to do.
- Beholder decides to use its eye-rays.
Then you see how your action works. In case of an attack action, you make the attack roll, in case of a spell, you choose the AoE or, in case of the beholder rays, you roll to check what kind of ray it has available in that turn.
- Beholder rolls its dice and it gets disintegrate, death ray and sleep ray.
Then, it chooses the target.
- It decides to use the three of them on the same wizard.
I find it rough. It makes the beholder way more dangerous.
But it gets closer to the 4e version (when the beholder could always choose 2 rays on its turn). The beholder can always choose its targets anyways (3 each turn, plus the ones of its legendary actions), and on the top of that, it is able to choose always the same target to be disintegrated? That sounds like too much.
You could use both ways, really, by rolling the dice after choosing the targets to make the combat easier; then, if you think your players are more than capable of facing the beholder, roll the dice before choosing the targets.