How to randomize turn order

Hello.

In my current project you can play with up to 4 players. Now I wonder how I can randomize the turn/play order of the players, so the game knows who starts first, who second etc. .

Player 1

Player 2

Player 3

Player 4

What would be the best way to randomly assign the turn number to the players?

Thanks in advance.
For a quick script solution, you can place the players inside an array and use shuffle: http://ruby-doc.org/core-1.9.3/Array.html#method-i-shuffle
Thats a great idea. Now I only have to figure out how this works in Ruby. Only did this in Game Maker so far. 😀

How can I, for instance, refer to RPG Maker objects in Ruby? For example character name, Char_X's Attack, or object ID? Is there a list of commands or something like this?

Found a tut (http://forums.rpgmakerweb.com/index.php?/topic/6248-script-call-equivalent-of-events/)

Thank you. 

Edit: Oh I see, I could put the characters names and stats in the array, too. But I still need to know how I can move objects through the script.

Edit 2: And is there a way to make script variables/arrays global?   Ok I'll just use $game_variables[] to manipulate the variables.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-randomize-turn-order.41314/