In A1, write the formula =if(rand()<0.5,"H","T"), and expand for 20 rows.
It can be helpful to break this formula down:
if (
rand() < 0.5,
"H",
"T"
) This if has three inputs inside its parentheses. rand()<0.5 is an expression that is either true or false."H" will be written IF the expression is TRUE."T" will be written if the expression is FALSE.