Re: Quick Question
- To: mathgroup at smc.vnet.net
- Subject: [mg78274] Re: [mg78090] Quick Question
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Wed, 27 Jun 2007 05:31:15 -0400 (EDT)
- References: <200706221050.GAA16639@smc.vnet.net>
rob cronin wrote:
> 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
> [...]
For those who have version 6 there is an expedient new function,
RandomSample, that does this directly.
In[8]:= RandomSample[Range[10]]
Out[8]= {3, 8, 7, 10, 4, 1, 9, 2, 5, 6}
In[9]:= RandomSample[Range[10],3]
Out[9]= {7, 8, 3}
Daniel Lichtblau
Wolfram Research
- References:
- Quick Question
- From: "rob cronin" <cronin_rob@hotmail.com>
- Quick Question