How does the Housing Office choose which college you get?

Is it first-serve basis? Or is it random?