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

MathGroup Archive 2011

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

Search the Archive

Re: Coin Toss Sim

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122384] Re: Coin Toss Sim
  • From: Tomas Garza <tgarza10 at msn.com>
  • Date: Thu, 27 Oct 2011 06:29:40 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110262139.RAA00063@smc.vnet.net>

Try
In[2]:= Tally@RandomChoice[{"head", "tail"}, 1000]
Out[2]= {{"tail", 488}, {"head", 512}}
-Tomas

> Date: Wed, 26 Oct 2011 17:39:20 -0400
> From: poolebc221 at gmail.com
> Subject: Coin Toss Sim
> To: mathgroup at smc.vnet.net
>
> 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}
>   ]
>
 		 	   		  


  • References:
  • Prev by Date: Re: Coin Toss Simulation
  • Next by Date: Re: Full simplify problem - thanks
  • Previous by thread: Re: Coin Toss Sim
  • Next by thread: Re: Coin Toss Sim