Sometimes, on the first day or so in Minecraft, when I'm obsessed about killing mobs for food, I find that, at night, animals tend to flock towards light sources
For example, day 1, I built a house on the beach, and set up a couple of torches. I went outside, and there were some animals that were making their way towards the torches, and spent the rest of the night around them.
Was this by chance? Or are there factors (besides Wheat) that determines where animals move towards?