How to form a static int array from different void functions

Hello Unity…I’m fairly new to this. I am trying to form a static int array from different void functions; namely (num, num2, num3, num4) within my script. Here is how it looks like; Kindly help. Thanks

using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using System;
 
 public class Food_Generator : MonoBehaviour
 {
     
     public Image randomImage;
     public Image randomImage2;
     public Image randomImage3;
     public Image randomImage4;
     
     public Sprite[] images;
 
     void Start()
     {
         changeImage1();
         changeImage2();
         changeImage3();
         changeImage4();        
     }
 
     void changeImage1()
     {
         int num = UnityEngine.Random.Range(1, 9);
         randomImage2.sprite = images[num -1];
     }
 
     void changeImage2()
     {
         int num2 = UnityEngine.Random.Range(1, 9);
         randomImage3.sprite = images[num2 - 1];    
     }
 
     void changeImage3()
     {
         int num3 = UnityEngine.Random.Range(1, 9);
         randomImage4.sprite = images[num3 - 1];        
     }
 
     void changeImage4()
     {
         int num4 = UnityEngine.Random.Range(1, 9);
         randomImage.sprite = images[num4 - 1];        
     }
 }

Hello. Create a static int array like this:
public static int[] arrayName = new int[4];.
Then for each function add arrayName[whatever] = numWhatever; on the end.

Other things to consider: There is no need for UnityEngine in UnityEngine.Random.Range() because you are already using UnityEngine.
If you are subtracting 1 from num, you could just use Random.Range(0,8) and not have to subtract.
Since the functions are basically doing the same thing, you could consider using a for or foreach loop to make it cleaner.

Hope this helps.

Thanks a tonne!!! One more thing… how do I print it on to the console? @TheQwertz