What is the best way to pick random value form enum in other class?

first, I have a enum class Card

public class Card{}

public enum CardType{
	AAA,
	BBB,
	CCC,
	DDD,
	EEE
}

So what do I want to do, is use a method CardGenerate in another class, let’s say PlayCard.cs, and generate a card with random card type from the enum.

So what is the best way to do it?

Although this could be achieved by set simple array and random from elements, but it just looks like not so professional.

BTW, what’s the best usage for enum?

thanks.

If you kn. the exact length of the enum, you can generate a random value with the Random class. Then you make. wraper class that gets you the entry of the enum depending on the value.

I wouldn’t reccomend an enum, better use a static array and then you can use the lengt and a direct acces without a wraper.

If you want to modify the Array during runtime, I would reccomend a list from System.collections.generics, that gives you more control over adding and removing Elements.

Greetings
Chillersanim