Microstates of coin tossing

L . A . 2023

Many coins flip randomly between H and T, one at a time . Starting with all T' s,  how will equilibrium be established?

(* parameters *)
ClearAll;ncoins=500;p=1/2;
ntrials=8000;

(* initial conditions *)
poss={"H","T"};
init=Table["T",{i,ncoins}];

(* maximum of the Binomial *)
max=PDF[BinomialDistribution[ncoins,p],ncoins/2];
(* plot of the Binomial *)
bin=ListPlot[Table[{x,1/max*PDF[BinomialDistribution[ncoins,p],x]},{x,0,ncoins}],Joined->True,PlotStyle->Red,PlotRange->All];

(* randomization *)
plot={};init=Table["T",{i,ncoins}]; Do[{rc=Random[Integer,{1,ncoins}];flip=Random[Integer,{1,2}];init[[rc]]=poss[[flip]];hc=Count[init,"H"];
AppendTo[plot,Graphics[Disk[{hc,1/max*PDF[BinomialDistribution[ncoins,p],hc]},{ncoins/100,.03}],PlotRange->{{0,ncoins},{-0.1,1.5}},Frame->True,AspectRatio->0.5,PlotLabel->"Number of Hs",Epilog->Text[StringJoin[init[[ncoins/2-30;;ncoins/2+30]]],{ncoins/2,1.3},BaseStyle->{11}]]]},{j,ntrials}]

Manipulate[Show[plot[[i]],bin,ImageSize->600],{i,1,Length[plot],1}]