MathGroup Archive 2008

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

Search the Archive

Re: Shuffle problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg84977] Re: [mg84960] Shuffle problem
  • From: "Thomas Dowling" <thomasgdowling at gmail.com>
  • Date: Mon, 21 Jan 2008 06:59:53 -0500 (EST)
  • References: <200801210911.EAA09615@smc.vnet.net>

Hello,

I suppose you could try RandomSample


In[3]=  list = {a, b, c, d, e, f, g, h, i, j, k, l};


In[5]= RandomSample[list, Length[list]]

Out[5]= {b, j, e, i, c, l, f, g, h, a, k, d}

In[8]= RandomSample[{t, t, t, h, h, h}, Length[{t, t, t, h, h, h}]]

Out[8]= {t, h, h, h, t, t}

(Using Version 6.0.0)

Tom Dowling

On Jan 21, 2008 9:11 AM, angela <mpopyft at lycos.com> wrote:

> Hi;
>
>  Is there a way to get Mathematica 6.01 to randomly shuffle a list: Is
> there a built in command that I am blind to?
>
> For example:
>
> {t,t,t,h,h,h}  would become something like {t,h,h,t,t,h}
>
> The lists are of arbitrary length. I wrote my own function but it is kind
> of slow.
>
> Thanks;
> Angela
>
>



  • Prev by Date: Re: Shuffle problem
  • Next by Date: Re: Fonts in Mathematica 6.0
  • Previous by thread: Re: Shuffle problem
  • Next by thread: Re: Shuffle problem