MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Dont Understand


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}
>                    ]





  • Prev by Date: Generalized Cross Validation package?
  • Next by Date: Plot[] problem (plnr) - help !!!
  • Previous by thread: Re: Dont Understand
  • Next by thread: Re: Dont Understand