Generate random number per function call?

Hey guys!

I’m trying to simply generate a random number. (either 1 or 2) and use that random number to choice a different “if condition”.

What I’ve got works, but only chooses the number 1 every time.

here’s what I have;

function Death ()
{
	speed = 0.0;
		
	var deathChoice = Random.Range (0, 2);
		
	if ( deathChoice == 1 )
	{
		print ( deathChoice );
		animation.Play("Death01");
		yield WaitForSeconds (1);
		Destroy (gameObject);			
	}
	if ( deathChoice == 2 )
	{
		print ( deathChoice );
		animation.Play("Death02");
		yield WaitForSeconds (1);
		Destroy (gameObject);
	}
}

In the documentation, it says that Random.Range(int,int) is where minimum is inclusive and maximum is exclusive. So, if you want it to give a random number of either 1 or 2, then it should be:

Random.Range(1, 3);

Random.Range