Re: Simulation
- To: mathgroup at smc.vnet.net
- Subject: [mg19388] Re: Simulation
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 23 Aug 1999 13:57:07 -0400
- References: <7pl679$cdc@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Roberto Diego <r-diego at develnet.es> wrote in message news:7pl679$cdc at smc.vnet.net... > Hi there, > > I need help on how the expression: > > data=Table[NestList[#+0.01*Random[Integer,{-1,1}]&,5,1000]]; > > could be modified in order to get -1 with probability 1/6, 0 with p 4/6 and > 1 with p 1/6 instead of 1/3,1/3,1/3 > > Thanks a lot > > Roberto Diego > Sociedad de Bolsas > > > Roberto, f := Switch[Random[], _?(# <= 1/6 &), -1, _?(# <= 5/6 &), 0, _, 1 ] Test: test = Table[f, {10000}]; Count[test, -1] 1659 Count[test, 0] 6668 Count[test, 1] 1673 Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565