So I'm making a card game and I have a card database with 42 unique cards and when I play I made it so that it creates a random deck using those cards, but how could I make it so that there is not two of the same card?
Here is the code I used to far to generate the player deck:
using System.Collections.Generic;
using UnityEngine;
public class PlayerDeck : MonoBehaviour
{
public List<Card> deck = new List<Card>();
public int x;
// Start is called before the first frame update
void Start()
{
x = 0;
for(int i = 0; i < 42; i++)
{
x = Random.Range(1, CardDatabase.cardList.Count);
deck[i] = CardDatabase.cardList[x];
}
}
// Update is called once per frame
void Update()
{
}
}```