MathGroup Archive 2004

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

Search the Archive

Re: Random Matrix of Integers


Bruce,

not very elegant but leads to the desired result:

<< "Statistics`DiscreteDistributions`"

In[185]:=
unidist = DiscreteUniformDistribution[8];
x = {};
Do[x = Union[x, {1 + RandomArray[unidist, {4}]}], {4}];
   MatrixForm[x]

Out[187]//MatrixForm=
MatrixForm[{{3, 5, 3, 7}, {4, 6, 2, 6}, {5, 6, 9, 4},
    {8, 7, 5, 8}}]

Wolfgang

Bruce W. Colletti wrote:

> To create a 4x4 matrix of random integers drawn from {2..9}, I use:
> 
>     A = Table[Random[Integer, {2, 9}], {4}, {4}]
> How can I do this using RandomArray?  Thanks.
> 
> Bruce
> 
> 


  • Prev by Date: Re: Advection-Diffusion Equation with variable coefficients
  • Next by Date: Re: how to take quotation marks away ?
  • Previous by thread: Re: Random Matrix of Integers
  • Next by thread: Re: Random Matrix of Integers