Array Question

I have an array that is so long

public string wordz = new string {
“both”,
“bowl”,
“bulk”,
“burn”,
“bush”,
“busy”, …

but I wanna output 5 elements only

  public static void Shufs<T>(T[] arr)
{
    for (int i = arr.Length - 1; i > 0; i--)
    {
        
        int r = Random.Range(0, i);
        T tmp = arr*;*

arr = arr[r];
arr[r] = tmp;
// var linesx = arr[r];
}

}
this is my shuffle array I want to randomize 5 elements with an array of 10000 words. help please

Your idea is twisted:

-You have a huge list of words (let’s call it your src)

-You want to pick randomly five elements in your src

-return this array

Then what you have to do is something like that

//To use this you need to specify the template in the class
//Check https://msdn.microsoft.com/library/sz6zd40f.aspx for more infos
T[] sample;

public Start()
{
    sample = new T[5]
}



 public static void Shufs(T[] arr)
 {
     for (int i = 0, i < 5, i++)
     {
         
         int r = Random.Range(0, arr.Length());
         sample *= arr[r];*

}
}
//then you can use sample field to access your 5-elements array