Syntax problem trying to find random enum

I’m trying to massage a function to grab a random item from any enum, and I’m getting a boatload of syntax errors- is there an obvious flaw with what I’m doing?

public static T GetRandomEnum<T>(){
		Array values = Enum.GetValues(typeof(T));
		return  (T)values.GetValue(UnityEngine.Random.Range(0, values.Length));

Array and Enum type is in the System namespace, so add this syntax to the first line in your code :

using System;