MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Coin Toss Sim


Every place you write g it runs the RandomChoice code again. So, the values of g it uses when evaluating your s in {g, s} is not the same as the one it uses in the g in {g, s}.
You want the list for the same realization. I would write something like
y[n_]:=With[
    {g=RandomChoice[{"head", "tail"}, n]},
    {g, Count[g, "head"]}
    ]



  • Prev by Date: Combine sqrts in denominator
  • Next by Date: Re: Coin Toss Sim
  • Previous by thread: Re: Coin Toss Sim
  • Next by thread: Re: Coin Toss Sim