Instantiate an image alteast twice and maximum in even numbers

I’m creating a grid in even numbers where I have to instantiate random images from from the array.

And I have Initialized the array with a folder in resources. My image is instantiating, but I want to instantiate it in even numbers. What I mean is the topic is about matching two images.

This is my code:

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

public class OnetConnectManager : MonoBehaviour
{
    public GameObject EmojiPrefab;
    public float Row, Col;
    [SerializeField]
    Sprite[] AllEmojis;
    private void Start()
    {
        AllEmojis = Resources.LoadAll<Sprite>("Emojis");
        CreateGrid();
    }
    private void CreateGrid()
    {
        for (int i = 0; i < Row; i++)
        {
            for (int j = 0; j < Col; j++)
            {
                GameObject G = Instantiate(EmojiPrefab);
                G.transform.position = new Vector3(j * 3.5f, i * 3.5f, 0);
                G.transform.GetChild(0).GetComponent<SpriteRenderer>().sprite = AllEmojis[Random.Range(0, AllEmojis.Length)];

            }
        }
    }
}

Are you trying to create a grid where the location of the images are random, but each image appears exactly twice in the grid?

I am assuming that Row * Col = 2 * number of Sprites.

You could create two List and populate them with the same set of sprites. As you walk through the grid, first randomly select between the two lists, then randomly select a value from the list. Remove the entry from the list after it is used. Since each Sprite is located once in each list, it guarantees that each Sprite will appear exactly two times.
When randomly selecting between the two lists, you’ll need to ensure you are picking a non-empty list.

using System.Collections.Generic;
using UnityEngine;

public class GamePlayManager : MonoBehaviour
{
[SerializeField]
Sprite AllEmojisArray;
[SerializeField]
GameObject EmojisObjectArray;

List<int> Emojis;
int Row = 5, Col = 8;
private void Start()
{
    Emojis = new List<int>();
    int EmojisCreate = Row * Col / 2;
    RandomEmojisCreate(EmojisCreate);        
}

void RandomEmojisCreate(int indexNo)
{
    for (int i = 0; i < indexNo; i++)
    {
        int num = Random.Range(0, AllEmojisArray.Length);
        Emojis.Add(num);
        Emojis.Add(num);
    }

    ReshuffleArray(Emojis);
}
void ReshuffleArray(List<int> arrayCount)
{
    for (int i = 0; i < arrayCount.Count; i++)
    {
        int tmp = arrayCount[i];
        int r = Random.Range(i, arrayCount.Count);
        arrayCount[i] = arrayCount[r];
        arrayCount[r] = tmp;
    }

    RendomEmojisCreate();
}

void RendomEmojisCreate()
{
    for (int i = 0; i < Emojis.Count; i++)
    {
        EmojisObjectArray[i].transform.GetChild(0).GetComponent<SpriteRenderer>().sprite = AllEmojisArray[Emojis[i]];
    }
    int EmojiIndex = 0;
    for (int i = 0; i < Row; i++)
    {
        for (int j = 0; j < Col; j++)
        {
            EmojisObjectArray[EmojiIndex].transform.position = new Vector3(j * 3.5f, i * 3.5f, 0);
            EmojisObjectArray[EmojiIndex].gameObject.SetActive(true);
            EmojiIndex++;
        }
    }
}

}