Before we start: Why does the code not know the random events beforehand? Without interaction, couldn't you just as well calculate them in advance without any difference in the player's experience? And if their effects affect the battle, how can you know the number of main events without knowing the impact of random events? Ah, I probably don't need that part of the picture, so let's get started with the mathing.
This is a math question at first glance, but there's more to it than that. I would factor the nature of events into determining their frequency.
What I gather from your examples is that there are basically turn-based actions and random (environmental) effects. These two are different concepts that depend on different factors, so the player will have different expectations as to when they happen. There is also a different impact of the effects based on when they happen.
The frequency of turn-based actions should be related to the abilities of the character. It would make little sense for the same sword attack to take twice as long as usual because it is starting to rain, and then take the normal time while it's still raining. The battle speeding up bit by bit makes sense, and reflects the growing desperation and determination to win before running out of strength or getting killed yourself. Speeding the battle up means we have higher action density towards the end of the battle.
Random events happen, well, randomly. The player will have very few expectations here, except maybe a reasonable distance between events like weather changes. But nobody would be surprised if, a minute after it starts raining, a wild boar charges out of the nearby woods. This means you have a lot more freedom with the random events. However, in order to affect the battle, they would have to happen early.
This is quite fortunate. We can have random events happen mostly in the first half of the battle, while the constant acceleration pushes attacks into the second half.
In other words, accelerating the turn-based actions opens a time window for the random events.
My solution would be to implement two timelines:
Turn-based actions happen in a mostly uniform fashion, each action up to 10-20% faster than the previous. That allows you to add up the factors and scale them against the total.
Random events mostly happen in the larger time spans at the beginning of the battle. You can time them to be 1/3 to 2/3 of the way to the next event for a randomized but even distribution. Sometimes they do happen between the shorter turns at the end, but I'd keep the probability for that low, maybe by scaling effect probability with duration of the next action.
I would avoid using the loop to calculate time, but rather calculate all beforehand and just check the system time to see if it's time to display the next event. That saves cpu usage if the game is running on a device that is multitasking, even if it's just a few cycles.
Let's start with the turn-based actions:
Calculate duration modifiers, get each by randomly modifying the previous one
Using ~20% and 6 actions for a more visible effect here
Example random duration modifiers of 6 turn-based actions:
D0=0, D1=1, D2=0.8, D3=0.72, D4=0.67, D5=0.55
calculate the sum of all duration modifiers up to the
current modifier to get the timestamp modifier
T0=0, T1=1, T2=1.8, T3=2.52, T4=3.19, T5=3.74
Scaling towards the desired total time:
Total time is proportional to the last modifier.
Divide total time by it to get the time scale factor
1800sec/3.74 = 481,28sec (whatever precision you need)
Multiply each time modifier with the time factor
to get the time its event happens
Ex.: T3 = 2.52 x 481,28 = 1212sec = Minute 20 (:12sec)
Each of these sets of calculations fit nicely into a for loop handling an array.
Now to designate a time to the random events.
We shift the probability towards the beginning of the battle to balance against acceleration.
I'll show two samples for comparison
Do this whenever you display a turn-based action :
Get the duration modifier of the next action
T1.next = D2 = 0.8
T4.next = D5 = 0.55
Square the number to shift the probability to the early battle.
These are your probability modifiers.
P1 = 0.8^2 = 0.64 chance for random event to occur between T1 and T2
P4 = 0.55^2 = 0.3025 chance for random event to occur between T4 and T5
...maybe use 3rd or higher power to increase the difference
and make late effects something 0.1-ish...
In case of a random event,
place it halfway to the next turn-based action, +/- 1/3.
Disclaimer: This is by no means balanced, but demonstrates a way to push events between others while maintaining a relative scale of time between events and might be a starting point for your own design.