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 Reply

Your email address will not be published. Required fields are marked *

*