Re: Dont Understand
- To: mathgroup at smc.vnet.net
- Subject: [mg15885] Re: Dont Understand
- From: "rod" <unforgettable20 at hotmail.com>
- Date: Wed, 17 Feb 1999 23:33:36 -0500
- Organization: [posted via Easynet Ltd]
- References: <7a2bm8$1ts@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Try: init[n_Integer]:=Module[ {s=Table[Random[Integer],{n n}]}, s=s/.{0->-1}; Partition[s,n] ] cheers, rod ---------------------------------------- ma re bes da re. as ba re! ---------------------------------------- Don McKenzie Paul wrote in message <7a2bm8$1ts at smc.vnet.net>... > >I'm not an expert in Mathematica and would appreciate comments on why >init1 returns a list with all zeros replaced by -1, but init does not. >Its probably very simple but its confused me. > >Don > >init[n_Integer]:=Module[ > {s=Table[Random[Integer],{n n}]}, > s/.{0->-1}; > Partition[s,n] > ] > >init1[n_Integer]:=Module[ > {s=Table[Random[Integer],{n n}]}, > s/.{0->-1} > ]