Is it me or does it seem when spiders are somewhere, they get in little groups of 3/4/5 and start attacking you? I guess it's just me, as it feels like they spawn so close together.
Yes, most Mobs tend to spawn in groups, this can happen to any Mob but Squid, Enderdragons, Snow Golems and Iron Golems.
This exactly. This is why in large and flat open areas you get copious amounts of mobs - Mobs spawn in "packs" of 1-4 I believe, and other mobs in the pack only spawn on (Or near) the same Y co ordinate. Not 100% sure about this but I remember reading something about this on the wiki a while ago.
Mobs spawn in packs, yes. This is because it looks nicer when there are 5 cows or skeletons next to eachother, than just random mobs appearing everywhere.
Eummmmmmmm... as a lot of people has already said, it is not a "random" thing that happens sometimes. That is the way Minecraft spawns (almost) every mob. That is like saying... "ey, ey, look... when it is dark, and I am far away, mobs appear randomly!!". No, it is just the way MC works.
Directly from the wiki: (Warning, WoT)
" For each spawning cycle, one attempt is made to spawn a pack of mobs in each eligible chunk. A random location in the chunk is chosen to be the center point of the pack. For the pack to spawn at all, the center block must be water for water mobs and air for all other mobs. Note that in the latter case, it must literally be an air block. Any other block, even a non-colliding one, will prevent the entire pack from spawning.
If the pack location is suitable, 12 attempts are made to spawn up to 4 mobs (8 for Wolves, 1 for Ghasts) within a 41x1x41 area centered at that block (that's a 41x41 square that is one block high). Mobs will spawn with the lowest part of their body inside this area. For each spawn attempt, a block location within the pack area is chosen at random. Though the pack area extends 21 blocks out from the center, the random location is heavily skewed toward the center of the pack. Approximately 85% of spawns will be within 5 blocks of the pack center, and 99% within 10 blocks of the center.
All mobs within a pack are the same species. The species for the entire pack is chosen randomly from those eligible to spawn at the location of the first spawn attempt in the pack"
This is the better version of what I was saying. However, I would like to add that the random choice of the mob depends on some variables in the code that determine how rare a mob is.
And xp ;D
This exactly. This is why in large and flat open areas you get copious amounts of mobs - Mobs spawn in "packs" of 1-4 I believe, and other mobs in the pack only spawn on (Or near) the same Y co ordinate. Not 100% sure about this but I remember reading something about this on the wiki a while ago.
This is the better version of what I was saying. However, I would like to add that the random choice of the mob depends on some variables in the code that determine how rare a mob is.