Generation

generate functionSun, 11 Dec 2022

randomize an enum Direction with Vertical and Horizontal

public enum Direction { Vertical, Horizontal } public static Direction RandomizeDirection() { return Random.Range(0f, 1f) > 0.5f ? Direction.Vertical : Direction.Horizontal; } RandomizeDirection();

Questions about programming?Chat with your personal AI assistant