Hiding a key item in a random location

I've looked around and can't seem to find what I'm looking for so hope someone can help me. I've been working on a game and you need to find a hidden key in a room before you can open a locked door. I have texts events set up for things like the drawers, flower pots, ect... and for when you find the hidden key. My question is how can I make the key appear in a different location each time the game is played instead of it always being in the same spot. Is this even possible? Thanks 🙂
Here's what I would do:

Upon entering the map in question, initialize a variable and assign it a random number from 0 to x.
x being the total amount of places the key can be at.

Then you can create conditional branches for each event where the key might be.

For example, if you have a drawer, you could have a conditional branch that checks if
the variable is 3 for example. If it is 3, you find the key, and if not, the text plays saying there is nothing there.

And like that, you basically assign each location a different variable from 0 to x.
Thanks. I'll try that 🙂
ScorchedGround thank you SO much. That worked perfectly.

Original thread: https://forums.rpgmakerweb.com/threads/hiding-a-key-item-in-a-random-location.126940/