You can make a list of numbers in a pool, then assign and remove them at random. You’ll need import System.collections.generic; to use a list. This will work, if you have a pool of numbers in mind that you want to use.
List<int> pool = new List<int>();
for(int i = 0;i < 30;i++)
{
pool.add(i);
}
for(int i = 0;i < item.Length;i++)
{
item[i] = pool[Random.Range(0, pool.Count)];
pool.RemoveAt(i);
}
Just a short note about Tomnnns code:
If you delete items from a list I would recommend to do this from the upper end to the lower end otherwise it’s possible to run into an AV (as soon as i is larger than the rest size of the list).