Hi there,
i'm not 100% sure, if i understand your question correctly, but have a look at this functions:
func randa(array : Array):
# Pick random number from input-array
return array[randi() % len(array)]
func randa2(array : Array):
# Create an array with 2 numbers from the input-array
return [randa(array), randa(array)]
func randav(array : Array):
# Create an Vector2 with numbers from the input-array
return Vector2(randa(array), randa(array))
You can try/use it like this:
func _ready():
# Example
randomize()
var array : Array = [0, 13, 42, 69, 101, 1337] # Random numbers
# Example with 1 Number
var number_1 = randa(array)
var number_2 = randa(array)
print("1: ", number_1)
print("2: ", number_2)
# Example with Array
var numbers = randa2(array)
print("[]: ", numbers)
# Example with Vector2
var vector = randav(array)
print("v2: ", vector)
This might do what you want :)