Re: Random Order of a Set of Numbers
- To: mathgroup@smc.vnet.net
- Subject: [mg10894] Re: Random Order of a Set of Numbers
- From: Allan Hayes <hay@haystack.demon.co.uk>
- Date: Thu, 12 Feb 1998 20:15:27 -0500
- References: <6bpvg8$b3j@smc.vnet.net>
JD Faith wrote:
> I need to generate a random list of the numbers 1-36, 33 times.
> The idea being to replicate the drawing 0f the numbers 1-36 from a
> hat 33 times.
Here is one way:
In[1]:=
nmbs = Range[36];
In[2]:=
rand:= Table[Random[],{36}]; (* makes a *new* list of 36 random reals
between 0 and 1 each time it is evaluated*)
In[3]:=
Table[
Last/@Sort[Transpose[{rand,nmbs}]]
(*sort nmbs by attached ,
{33}
]
--
Allan Hayes
Training and Consulting
Leicester, UK
hay@haystack.demon.co.uk
http://www.haystack.demon.co.uk
voice: +44 (0)116 271 4198
fax: +44 (0)116 271 8642