MathGroup Archive 2007

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

Search the Archive

Re: Quick Question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78189] Re: Quick Question
  • From: "Sem" <sarner2006-sem at yahoo.it>
  • Date: Mon, 25 Jun 2007 07:03:37 -0400 (EDT)
  • References: <f5gajp$gbg$1@smc.vnet.net>

Hi,
this is another approach:

In[1]:=
Scramble[l_List,n_Integer]:=Module[{x=Random[Integer,{2,Length[l]}]},
      If[n>0,
        Scramble[Flatten[Reverse/@Partition[l,x,x,{1,1},{}]],n-1],l]
      ];

where n is the number of calls of the function itself.

HTH,
    Sem.

"rob cronin" <cronin_rob hotmail com> news:f5gajp$gbg$1 at smc.vnet.net...
> Quick Question:
>
> With Mathematica 5.2 is there any way to scramble a simple list of 
> numbers:
> i.e. randomly rearange the list {1,2,3,4,5,6} without any apparent order.
>
> Kind regards
>
> _________________________________________________________________
> Get a preview of Live Earth, the hottest event this summer - only on MSN
> http://liveearth.msn.com?source=msntaglineliveearthhm
>
> 



  • Prev by Date: Re: search for an operator in an expression
  • Next by Date: CountryData "UnitedStates" "GovernmentSurplus" problem
  • Previous by thread: Re: Quick Question
  • Next by thread: HELP IN RECURSIVE ESTIMATION WITH MATHEMATICA