MathGroup Archive 1995

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

Search the Archive

Re: Challenge!


Dear Mathgroup,
        A solution for any number of lists of equal length.

swap[x_?MatrixQ] :=
Map[ Part[#,  Random[Integer, {1,Length[x]}  ]  ]&,
Transpose[ x ] ]

In[12]:=
swap[{{a,b,c,d,e}, {A,B,C,D,E}, {1,2,3,4,5}}]
Out[12]=
{A, 2, c, d, E}

Arnold Seiken



  • Prev by Date: Books
  • Next by Date: Re: Programming: List Structure Manipulation
  • Previous by thread: Re: Challenge!
  • Next by thread: Re: Challenge!