MathGroup Archive 2011

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

Search the Archive

Coin Toss Sim


I am new to mathematica and am trying to make a coin flipping simulation however mo code isn't working. When I tell it to count the number of head it gives me a bad count. The code I am using is listed below any help would be greatly appreciated.

y[n_] := Block[{g, s},
  
  
  g := RandomChoice[{"head", "tail"}, n];
  s := Count[g, "head"];
  {g, s}
  ]



  • Prev by Date: Re: Parameter Fitting in coupled differential equation
  • Next by Date: Re: algebraic ReplaceAll?
  • Previous by thread: Re: Error on importing previously saved data file: Get::bigfile
  • Next by thread: Re: Coin Toss Sim