i need a script for Random movement within specific locations

I have this script for random movement within specific locations but there are 2 problems first, it is for images and i want it for objects .Second the objects should not take the features of the original card.
please can you help me?

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

public class randpics : MonoBehaviour
{
public const int gridRows = 2;
public const int gridCols = 3;
public const float offsetX = 1.5f;
public const float offsetY = 1.5f;

[SerializeField] private MainCard originalCard;
[SerializeField] private GameObject[] images;

private void Start()
{
    Vector3 startPos = originalCard.transform.position; //The position of the first card. All other cards are offset from here.

    int[] numbers = { 0, 1, 2, 3, 4, 5};
    numbers = ShuffleArray(numbers); //This is a function we will create in a minute!

    for (int i = 0; i < gridCols; i++)
    {
        for (int j = 0; j < gridRows; j++)
        {

            MainCard card;
            if (i == 0 && j == 0)
            {
                card = originalCard;
            }
            else
            {
                card = Instantiate(originalCard) as MainCard;
            }

            int index = j * gridCols + i;
            int id = numbers[index];

        

            float posX = (offsetX * i) + startPos.x;
            float posY = (offsetY * j) + startPos.y;
            card.transform.position = new Vector3(posX, posY, startPos.z);
        }
    }
}

private int[] ShuffleArray(int[] numbers)
{
    int[] newArray = numbers.Clone() as int[];
    for (int i = 0; i < newArray.Length; i++)
    {
        int tmp = newArray*;*

int r = Random.Range(i, newArray.Length);
newArray = newArray[r];
newArray[r] = tmp;
}
return newArray;
}
}

Hi there, I need to say this is very unspecific, because the script you added here do the things that it want to do alone. The questions is therefore to you “where do you need a random movement in a specific location”?
Please note, that your script “randpics” is not added to the “Code Sample” area completely, what it makes hard to understand.

  1. To you first problem: It is not for images. You get Objects especially an array of GameObjects that is called images

  2. To the second problem: Please note line 6: the reason why the features taken from the “Original Card” is because you take it from the MainCard variable called originalCard. If you want to Change that, you can change the Objects referenced to MainCard object. Depending on the case what you want to do you can also change the line 6 completely to i.e.,

    //before change
    Vector3 startPos = originalCard.transform.position;
    
    
    //exchange this line with
    // this creates an Vector3 with random numbers for x between 0 and 1
    // for y between 2 and 3 and for z between 1 and 2
    Vector3 startPos = new Vector3(Random.Range(0, 1.0f), Random.Range(2.0f, 3.0f), Random.Range(1.0f, 2.0f));
    

I hope it makes it a little bit more understandable what your script do. If you have more or other questions maybe we can try to find an answer.

Thanks for your answer, but it didn’t solve the problem…

Can you please give me a script to change the position of the images within specific positions
So that each image appears once and changes its position each time with the start of the game.?