The Pokemon inside Max Raid dens are generated prior to the battle. For raids spawned with a Wishing Piece, the Pokemon is generated briefly after you accept the prompt to save the game. I'm not sure what the precise timing is for dens with naturally-occurring beams, but again, it's absolutely prior to the fight.
I know this because I have caught a Pokemon from a Max Raid, checked its IVs and nature, then turned off my game without saving and attempted the raid again only to find the Pokemon had exactly the same characteristics as it did the first time. If the Pokemon was generated at a later point, then this would not have occurred. Furthermore, I can check the same den multiple times throughout the day and its contents will be identical each time, which is a further indication that raid dens don't change until they're defeated (or roll over at midnight).
These circumstances mean that it's impossible to 're-roll' the stats for Pokemon in a den by saving and resetting. There is an exploit you can use to make the Pokemon inside the den roll over instantly, but this replaces the species and star-rarity of the raid as well. As such, there isn't an efficient way to Shiny hunt or IV hunt Max Raids. You need to get lucky.
One thing this system does allow you, however, is repeated attempts at catching the same raid Pokemon without fear of losing a trait you liked in the first encounter, e.g. a Hidden Ability. It also allows you to infinitely clone a Pokemon with traits you like if you have a friend do the raid with you, have them catch the Pokemon, then close and re-open the game on your system (without saving) to start the same raid with your friend once again.
My friend and I have multiple identical Adamant 5 IV Ditto from abusing this system on Den 66 and getting a bit lucky, so I can guarantee that IV generation (and by extension, Shiny generation) works this way. Let me know if you'd like a more precise tutorial on how to do this yourself; this video is sufficient (and also covers the 'save spamming' technique to manipulate the beam colour), if you can handle the YouTuber cheese.