Vector3 randomize spawnpoints

Okay, so I’m trying to make a multiplayer game with randomized spawnpoints. maybe spawnpoint;
A: 0,0,0
B: 10,2,4
C: 9,2,8
etc.

Now if I make an array how do I randomize 1 position from our positions[3];
Randomrange doesn’t work for me or I’m doing it wrong. Here’s a bit of sample code:

var positions : Vector3[];
var Health = 100;
var Deaths = 0;
var isDead : boolean = false;

 function Playerdeath()
 {
Respawn();
 Health = 100;
Deaths +=1;
isDead = false; 
 }
 
 function Respawn()
 {
 var ResPos : Vector3 = positions[Random.Range(0,   positions.length)];

transform.position = Vector3 (ResPos);
}//move the player on death to new position with full health again add 1 to death count

so any suggestions?

Seems correct. Do you have set position array?

EDIT:

I try the code and is fully functional, except for last row, i get build error. This is correct:

var positions : Vector3[];
var Health = 100;
var Deaths = 0;
var isDead : boolean = false;
 
function Start()
{
    Respawn();
    Health = 100;
    Deaths +=1;
    isDead = false; 
}
  
function Respawn()
{
    var ResPos : Vector3 = positions[Random.Range(0,   positions.length)];
    transform.position = ResPos; 
}

P.S.: I used method Start() for my convenience