Re: reducing the time of constructing a List
- To: mathgroup at smc.vnet.net
- Subject: [mg57595] Re: reducing the time of constructing a List
- From: "Kezhao Zhang" <kezhao.zhang at gmail.com>
- Date: Wed, 1 Jun 2005 06:04:32 -0400 (EDT)
- References: <d7haeo$3pa$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Don't use the For loop, use either Map or pattern matching: lst=If[#==1,1,0]&/@Table[Random[Integer, {0, 10}], {100000}]; lst=Table[Random[Integer, {0, 10}], {100000}]/._?(#!=1&):>0; Hope this helps. K. Zhang