How do I get a random number with or

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By leon4aka

Hello, how do i get a random with or? I need 90, 180, or 360 not other random values. I tried it like so: “rotation = 90 or 180 or 360”

:bust_in_silhouette: Reply From: exuin

Here’s one way:

const ANGLES = [90, 180, 360]

func _ready():
    randomize() # You must call this function to randomize the seed

func pick_random_angle():
    return ANGLES[randi() % 3]