Verse (2:155) And We will surely test you with something of fear and hunger and a loss of wealth and lives and fruits, but give good tidings to the patient,
This is life is only temporary, and it is a test to see how the hungry will react. i.e do you steal, and spread corruption on earth, or do you not steal, and work hard for your bread etc.. God doesn't have to give us food, our existence in itself is a privilege, not a right.
Allah (SWT) is the inevitable truth, and he says in the quran that he is just, which is enough for me alhamdulilah.