(*Bernulli*)

simulateBernulli[p_][numTraj_,trajLength_]:= Module[{trajData , finalPositions , trajCoordinates},
trajData = Table[RandomChoice[{1-p,p}->{-1 , 1} , trajLength ] , {numTraj}];
finalPositions = Total/@trajData;
trajCoordinates = Join[{0} , Accumulate[#]]&/@trajData;
{finalPositions , trajCoordinates , trajData}
];

drawTraj = Line[Partition[Riffle[# , 1.2 ((Dimensions[#][[1]]-Range[Dimensions[#][[1]]])/Dimensions[#][[1]])] , 2]]&;

sim = simulateBernulli[0.5][1000 , 10];

Manipulate[
Show[Histogram[sim[[1]][[1;;nn]] ,{Table[0.5 +x  ,{x , -300 , 300 , 1}]} , "Probability"] ,Graphics[drawTraj@sim[[2]][[nn]]],AxesOrigin->{0,0},AxesLabel->{"(Subscript[x, 10])" , "P"} , PlotRange->{{-10 , 10} , {0 , 1.2}} ] , {nn , 1 , Dimensions[sim[[1]]][[1]],1}]

p[k_ , n_]:=((n!)/(2^n))(1/((((n+k)/2)! ((n-k)/2)!)));

Manipulate[
Module[{sim},
sim = simulateBernulli[0.5][numTraj , trajLength];
Show[Histogram[sim[[1]] , {Table[0.5 +x  ,{x , -300 , 300 , 1}]} , "Probability"] , Plot[p[x , trajLength] , {x , -300 , 300}] , PlotRange->{{-300 , 300} , All} , AxesLabel->{"x" , "P"}]
],{{trajLength , 1000} , 0 , 10000 , 1} , {{numTraj , 1000} , 0 , 10000 , 1}]

sim = simulateBernulli[0.5][1000 , 10];

Manipulate[
Module[{sim},
sim = simulateBernulli[p][1000 , 10];
Show[Histogram[sim[[1]] ,{Table[0.5 +x  ,{x , -300 , 300 , 1}]} , "Probability"] ,Graphics[{{Red , Thick , Line[{{10 (p - (1-p)) , 0},{10 (p - (1-p)) , 0.3}}]},{Blue , Thick , Line[{{10 (p - (1-p)) + (Sqrt[4 10 p (1-p)]) , 0},{10 (p - (1-p)) + (Sqrt[4 10 p (1-p)]) , 0.3}}]},{Blue , Thick , Line[{{10 (p - (1-p)) - (Sqrt[4 10 p (1-p)]) , 0},{10 (p - (1-p)) - (Sqrt[4 10 p (1-p)]) , 0.3}}]}}],AxesOrigin->{0,0},AxesLabel->{"(Subscript[x, 10])" , "P"} , PlotRange->{{-15 , 15} , {0 , 0.3}} ]] , {{p , 0.5} , 0 , 1}]