public static Actions GetRandomAction(Random rndGen, int degreeOfFreedom) { Array values = Enum.GetValues(typeof(Actions)); return (Actions)values.GetValue(rndGen.Next(degreeOfFreedom * 2)); }