Advice for a script call

I was wondering if someone could help me with this:

You can imagine this like prize pools.
Im rolling a variable to get random numbers, for multiple purposes. Lets suppose i want to get a number between 1-5
So first i create the following array into the variable #1:
Code:
$gameVariables.setValue(1,[1,2,3,4,5])

After that, i need to pick one of those numbers randomly and set it as value of the variable #2; with this one i do some conditional branching. At the end, i need to remove that number from the array, since it was used; so, what im needing advice with is the following:

-Getting a value from one of the numbers within the array, setting it as value of certain variable, in this case, variable #2
- After using it to whatever, remove it from the array, to prevent getting the same number again ( thats the full purpose of this, otherwise i would just roll one variable between the numbers..)

Thanks in advance.
You might want to use
Code:
$gameVariables(1).splice(index, 1)
index is the index of the element you just found. If you want to know more about arrays splice you can take a look at this.
Incredibly, i have solved it. I used the splice method, thanks for your advice. I managed to remove the items from the array at the time i want by the "specific" splice method, but actually used a prev. declared variable, connected at the same time with a random roll. Cheers to you.

Original thread: https://forums.rpgmakerweb.com/threads/advice-for-a-script-call.106892/