Re: Re: Simulation
- To: mathgroup at smc.vnet.net
- Subject: [mg19443] Re: [mg19400] Re: [mg19353] Simulation
- From: "Tomas Garza" <tgarza at mail.internet.com.mx>
- Date: Wed, 25 Aug 1999 01:25:14 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Oops! A misprint occurred in my message [mg19400]: In[8]:= data1 = Table[NestList[# + 0.01*g[Random[Integer]] &, 5, 1000]]; // Timing should read In[8]:= data1 = Table[NestList[# + 0.01*g[Random[]] &, 5, 1000]]; // Timing One comment. Most other answers to this problema have suggested the obvious approach, like (r = Random[]; Which[r <= 1/6, -1, r > 5/6, 1, True, 0]). However, this might be more difficult to implement if instead of only three values (-1, 0, 1) there were, say, 50 or 100, e.g. if one were simulating the operation of a mortality table. The one I gave can be applied to these more general situations with practically no additional effort, and it involves no noticeable increase in time. Tomas Garza Mexico City