Full disclosure: I am not a biologist and this is more of a general question about understanding antibiotic resistance of bacteria.
We are always told that careless antibiotics use is the cause of new more resistant bacteria, which can obviously devastate huge societies and even have global impact. At the same time from my knowledge it seems that bacteria mutates in a purely random fashion.
So, thinking about this concept probabilistically, the virus mutating and antibiotic consumption seem to be completely disjoint events such as:
$$P(M|A) = \dfrac{P(M \cap A)}{P(A)} =\dfrac{P(M) P(A)}{P(A)} = P(M)$$
Where $M$ is the event that the bacteria mutates and $A$ is the event of taking an antibiotic. I couldn't find any research online as to how $P(M)$ is actually modelled or what probability distribution it even roughly follows, but intuitively it would depend on time as the longer the bacteria spends inside the host the higher the probability of mutation would be. So from this train of thought it would seem that taking antibiotics would actually be a good idea as to eradicate the bacteria quicker and give it less chance to mutate down the line.
I am obviously not trying to discredit hundreds of years of research and understand that there must be a gap in my thinking somewhere. My question is, why are we told that antibiotics cause antibiotic resistance even though the mutations are described as 'random'?
(ELI5 explanations are preferred as I said I don't come from a biology background)