Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5912

Re: Coin Toss Sim

From Tomas Garza <tgarza10@msn.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Coin Toss Sim
Date 2011-10-27 10:33 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j8bc2k$8o7$1@smc.vnet.net> (permalink)
References <201110262139.RAA00063@smc.vnet.net>

Show all headers | View raw


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@gmail.com
> Subject: Coin Toss Sim
> To: mathgroup@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}
>   ]
>
 		 	   		  

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Coin Toss Sim Tomas Garza <tgarza10@msn.com> - 2011-10-27 10:33 +0000

csiph-web