Why is my random sound java script not working?

Hi, I am trying to create a button that, when you press it, you get a beep and then the same beep when you release your touch AND THEN one second after the second beep, there will be a randomly chosen sound from an array of 50 sounds that could be played. I studied a similar problem from Random Audio Clip Help - Unity Answers and put all my sounds in the array. I get two errors. One is: Assets/MyScripts/MaleSoberSound.js(31,18): BCE0044: expecting (, found ‘PlayRandom’.

and the other is: Assets/MyScripts/MaleSoberSound.js(31,31): UCE0001: ‘;’ expected. Insert a semicolon at the end.

I don’t know where to search to find what I’m doing wrong in my script. I would greatly appreciate help on this javascript I created.
Thanks so much in advance!!!
Tom
#pragma strict

var sounds: AudioClip[];


function Start ()
{

}

function Update ()
{

}

function OnMouseDown ()
{
	audio.Play();
	//Application.OpenURL ("http://www.google.com");
	Debug.Log ("I touched the Microphone!");
}


function OnMouseUp ()
{

	audio.Play();
	
	yield WaitForSeconds (1);

	function PlayRandom () //call this function to play a random sound.
	{
		if (audio.isPlaying) return; // don't play a new sound while the last sound hasn't finished.
		audio.clip = sounds[Random.Range(0,sounds.length)];
		audio.Play();
	}
	Debug.Log ("I released the Mic button.");

}

Hi mate you have your PlayRandom function inside your OnMouseUp function , I don’t think you can do that I think it should help , sorry if it doesn’t :wink: below is what I think it should be like.

 function OnMouseUp ()
 {
     audio.Play();
     
     yield WaitForSeconds (1);
 
     function PlayRandom (); //call this function to play a random sound.
     Debug.Log ("I released the Mic button.");
 
 }

function PlayRandom () //call this function to play a random sound.
     {
         if (audio.isPlaying) return; // don't play a new sound while the last sound hasn't finished.
         audio.clip = sounds[Random.Range(0,sounds.length)];
         audio.Play();
     }

Thank you so much #jimmycrazyskills!!! Without your help, I would not have been able to figure it out. The working script is below. Thanks again!!! Tom

#pragma strict

var sounds: AudioClip[];
var bip: AudioClip;

function Start ()
{

}

function Update ()
{

}

function OnMouseDown ()
{
	audio.clip = bip;
	audio.Play();
	Debug.Log ("I touched the Microphone!");
}


function OnMouseUp ()
{
	audio.clip = bip;
	audio.Play();
	
	yield WaitForSeconds (1);

	if (audio.isPlaying) return; // don't play a new sound while the last sound hasn't finished.
	audio.clip = sounds[Random.Range(0,sounds.length)];
	audio.Play();

	Debug.Log ("I released the Mic button.");

}