Random enum in C#

Array values = Enum.GetValues(typeof(AttackType));
Random random = new Random();
AttackType randomAttackType = (AttackType)values.GetValue(random.Next(values.Length));

 

Tagged with:

Leave a Comment

avatar