Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Coin Toss Sim

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122357] Coin Toss Sim
  • From: pooleman133 <poolebc221 at gmail.com>
  • Date: Wed, 26 Oct 2011 17:39:20 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

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