What should I do to switch the speed from walk to run in script

this is the first time I use blend tree after some tutorial,but i got confuse. the blend tree worked,
the character can smoothly swith from walk to run,but I dont know how to actually change the speed in scripts,i want to have two speed ,run and walk in game,but I dont konw how to do this in codeing ?

public float playerSpeed;
public float playerSpeeds; // assign 2 elements in inspector for both speeds. 0 for walking, 1 for running

void Update()
{
if(!animator.GetBool("running"))
{
playerSpeed = playerSpeeds[0];
}
else
{
playerSpeed = playerSpeeds[1];
}
}