Index: /main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py
===================================================================
--- /main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 13443)
+++ /main/waeup.uniben/trunk/src/waeup/uniben/students/utils.py	(revision 13444)
@@ -384,8 +384,10 @@
     def selectBed(self, available_beds):
         """Select a bed from a list of available beds.
-        In the base configuration we select the first bed found,
-        but can also randomize the selection if we like.
-        """
-        return available_beds[0]
+        Beds are sorted by the sort id of the hostel and the bed number.
+        The first bed found in this sorted list is taken.
+        """
+        sorted_beds = sorted(available_beds,
+            key=lambda bed: 1000 * bed.__parent__.sort_id + bed.bed_number)
+        return sorted_beds[0]
 
     # Uniben prefix
