There are two possible explanations that come to mind:
1. Stargate travelers most likely knew their destination when they dialed the address, and there is no evidence that random dialing was a common practice.
There are 1,987,690,320 possible gate addresses that can be dialed locally in the Milky Way Galaxy and 1,168,675,200 that can be dialed locally in the Pegasus Galaxy [1]. In S01E01, Carter says that her research team tried dialing "hundreds of permutations" but were so unsuccessful in their random dialing attempts that they assumed that the Stargate on Earth could only connect to the one on Abydos. Also, O'Neill enters the addresses from the Ancient Repository of Knowledge into the SGC dialing computer in S02E16, and in S10E04 Teal'c says that there are "thousands" of addresses in the Repository. The Repository's list should be complete since the Ancients built the Stargate network so even if there are 999 thousand addresses in the Repository, it's still only an approximately 1/2000 chance of dialing a valid address in the Milky Way. The odds seem to be far lower than that though based on the "thousands" estimate by Teal'c. The Pegasus Galaxy is a dwarf galaxy that is presumably smaller than the Milky Way which makes it seem like the odds of randomly dialing a gate there are even smaller. Thus it can be assumed in general that the percentage of valid addresses vs. possible addresses is so small that random dialing would be a huge waste of time.
As you noted, there is also a significant risk associated with dialing a random address and walking through the gate. What if the gate on the other side is floating in space, has an inhospitable environment, is surrounded by hostile lifeforms, is covered by an iris, etc? So even if a person did happen overcome the odds of randomly dialing a valid address, there is no compelling reason to go through the gate unless they have a probe or expendable minion. However, in SG-1 the SGC has probes but seems to still focus on known addresses from the Abydos cartouche and later the Ancient Repository of Knowledge. Also, the Goa'uld had probes and had plenty of people that they were willing to sacrifice, but the Abydos cartouche was still incomplete compared the Ancient Repository even after thousands of years of Goa'uld Stargate travel. So this all makes it seem nobody has ever seen any value in random dialing even if they have the technology to carry out a coordinated dialing campaign.
Given that the odds of randomly dialing any gate are small and that there is an inherent risk associated with traveling through a randomly-dialed gate, it seems that the most likely way that the Stargate was used by most civilizations was dialing known addresses that they received from someone that they trusted. Even the explorers seem to stick with addresses that they know lead to a destination that someone at some time marked as safe, and it would seem that other civilizations like Teyla's people would be even less likely to risk traveling to a random address.
Out of universe - comparing Stargate addresses to how people use phone numbers in the real world - people usually do not just dial a random phone number just to see who is on the other end of the line. Instead, they will consult a phone directory or they will receive a phone number from someone else. I would imagine that Stargate addresses would be shared in a similar manner - especially since the consequences of dialing a "wrong number" on a Stargate are much more severe.
2. The Pegasus Stargates may actually indicate whether they have dialed a Spacegate.
Some have noted that when a Stargate dials a Spacegate, it looks like all of the glyphs on the Stargate glow instead of just the address glyphs. (The earliest example of this is in the Atlantis series premiere.) I do not believe that the series addresses this directly and would have to look into this more myself in order to confirm that this is the case every time a Stargate dials a Spacegate, but this would address the specific case where someone would know if they had randomly dialed a Spacegate. However, it would not protect against other dangerous environmental factors which goes back to my previous point that Stargate travelers do not view random dialing as a good idea.