Call an item within variable array with a random generated variable?

Ok so I need to call specific items within an array using a random variable.

#This is my array:

$game_variables[1] = ["one", "two", "three", "four"]

#this is the call for one of the items above in the array
$game_variables[2] = $game_variables[1][rand[3]]

Except this doesn't work. I also tried:

$game_variables[3] = rand[3]

$game_variables[2] = $game_variables[1][$game_variables[3]]

Which doesn't work either.

So what am I doing wrong here? What RGSS3 'code' am I not aware of that needs to be in there, or is this even possible?
it should be rand(3), parentheses not brackets since rand is a function/method


Also AFAIK it should be rand(4), since random produces from 0 up to value-1
Like Engr. Adiktuzmiko said.

Square brackets have a differnt meaning as they indicate a special method call.

xy[4]  would be equal to  xy.[](4)  (invoke the method "[]" on the result of xy with argument 4).
Call Array#sample to get a random element from an array:

#This is my array:$game_variables[1] = ["one", "two", "three", "four"]#this is the call for one of the items above in the array$game_variables[2] = $game_variables[1].sampleThat way you can add or remove elements from the array without also having to adjust the integer passed to Kernel#rand or making the mistake Engr. Adiktuzmiko described.
I got it working now. Thanks for the help and the link!

Original thread: https://forums.rpgmakerweb.com/threads/call-an-item-within-variable-array-with-a-random-generated-variable.37887/