title: Random Shuffle Listing in Unity 3D
body: <p>I'm in a little bit of a pickle. I have this script of an array that shows a listing of items. Now the thing is I only want this list to have five items shown out of ten and also shuffled, so you cant have the same list every time you start a new game. I was thinking if there should be a Random.Range implemented but I dont know where. Please Help and Thanks. Heres the script: `</p>
  
  <pre><code>public class RayCasting : MonoBehaviour
  {
      public float pickupDistance;
      public List&lt;Item&gt; items;
  
  
      #region Unity
      void Start ()
      {
          Screen.lockCursor = true;
      }
      void Update ()
      {
          RaycastHit hit;
          Ray ray = new Ray(transform.position, transform.forward);
          if (Physics.Raycast(ray, out hit, pickupDistance))
          {
              foreach(Item item in items)
              {
  
                  if(Input.GetMouseButtonDown(0)) {
                      if (item.gameObject.Equals(hit.collider.gameObject))
                  {
                      numItemsCollected++;
                      item.Collect();
                      break;
                          }
                  }
              }
          }
      }
  
      void OnGUI()
      {
  
          GUILayout.BeginArea(new Rect(130,400,100,100));
          {
              GUILayout.BeginVertical();
              {
          if (numItemsCollected &lt; items.Count)
          {
              foreach (Item item in items)
  
                          GUILayout.Label(string.Format("[{0}] {1}", item.Collected ? "X" : " ", item.name));
          }
          else
          {
              GUILayout.Label("You Win!");
          }
              }
              GUILayout.EndVertical();
      }
          GUILayout.EndArea();
      }
      #endregion
  
      #region Private
      private int numItemsCollected;
      #endregion
  }
  
  [System.Serializable]
  public class Item
  {
      public string name;
      public GameObject gameObject;
  
      public bool Collected { get; private set; }
  
      public void Collect()
      {
          Collected = true;
          gameObject.SetActive(false);
      }
  }
  </code></pre>
  
  <p>` </p>