Help with a card game event

I'm using RPG Maker VXAce and in the process of creating a card game.
I was able to create the deck, draw cards from the deck, have the card drawn match its respective picture etc.
The problem is: How do I get the event to store the information of which cards are drawn and make sure they are not drawn again?
I have made card games, and what I did was... I gave each card an ID. Those ID's are stored in an array. So you could say each ID is a card, and the array is the deck.

Then take out 1 random value from the array and use this value to as the card ID.

I would show you how I did it, but I use MV, which means my code is in javascript, while you need it in ruby.

Now you know what to do... Maybe you know enough ruby to take it from here, or someone else can explain how to take a random index from an array in ruby.
Nowadays it is not worth creating everything through events, the ideal would be to create Array variables:
  • The first would receive the shuffled cards.
  • The player's hand can be different for each player.
  • And another Array for cards discarded or eliminated during the dispute (cemetery)
I don't program RGSS, so I can't explain clearly how to do this, but I believe that RPGMakerVXAce has a simple method of writing an Array to a game variable.
I will deduce that it is like this...

Create Array/Deck:
Ruby:
$game_variables[300] = []

Ruby:
$game_variables[300] =[45,65,32,10,23]

Enter new value (buy card on shop/get a reserve deck card):
Ruby:
$game_variables[300].push(123)

Result: [45,65,32,10,23,123]

Enter other value:
Ruby:
$game_variables[300].push(251)

Result: [45,65,32,10,23,251]

Shuffle the cards in the deck:
Ruby:
$game_variables[300].shuffle

Result: As it says in the message, it will be drawn at random...



Move top card to another slot (copy and delete):
Ruby:
$game_variables[301].push($game_variables[300][0])
$game_variables[300].shift

Reference:

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-card-game-event.166723/