Atomic and electronic structure of random and ordered 2D alloys