Hi,
Per RFC 2328, a Router ID is a A 32-bit number assigned to each router running the OSPF
protocol. This number uniquely identifies the router within an Autonomous System.
The OSPF Router id is the highest IP address on the box or the loopback interface, calculated at boot time or whenever the OSPF process is restarted.
This RID is serving the purpose for uniquely identifying a Router, and that's why the IP address is choosed to be the value for Router ID.
The reason for preferring loopback IP address is due to the fact that a loopback interface will never go down ( as it is a logical interface in the router). Hence there wont be any disturbance in OSPF neighbor relation ship and adjancecies due to interface link flaps. Thats why it is a best practice to use Loopback interfaces in OSPF.
If no loopback interface is configured in the router, the highest ip address available in the router will be choosed as a Router ID.
Highest ip address, is numerically highest ip address.
In your example 192.1.1.1 is greater than 10.254.254.254.
Hope this helps
-VJ