Error when randomizing an array

Godot Version

4.6.2

Question

I am trying to randomize a list of variables when i press a button, but i get the following error message. can anyone help me fix this? I have added my code for the button.

extends Button



func _on_pressed() -> void:
	if global.Randomizedoptions.is_empty():
		global.Randomizedoptions = global.options.duplicate().shuffle()
	
	return global.options.pop_front()

and here is the code for my global variables:

extends Node

var mem1
var mem2
var mem3
var mem4
var mem5
var mem6
var slot_1_locked = false
var slot_2_locked = false
var slot_3_locked = false
var slot_4_locked = false
var slot_5_locked = false
var slot_6_locked = false
var options: Array = [1, 2, 3, 4]
var Randomizedoptions: Array = [ ]

What is the error message?

I was about to add it, i realized I forgot it.
I realized i had a wrong variable and fixed that but it still has the errors.
Line 7:Cannot get return value of call to “shuffle()” because it returns “void”.
Line 7:Value of type “null” cannot be assigned to a variable of type “Array”.

That’s the explanation then, you need to do:

global.Randomizedoptions = global.options.duplicate()
global.Randomizedoptions.shuffle()

thank you!