Since they all have a sort intelligence and they can reason and CHOOSE what they think and so on, I'd say the allspark creates transformers all alike, and then they choose what side.
Take that cellphone. It's "Born" inside a very tight hostile box. I wouldn't be happy. I'd try to get out, wouldn't you?
But then again, it might just all be random. ^^