Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Random Order of a Set of Numbers



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




  • Prev by Date: Re: output to a file
  • Next by Date: Re: Thank you
  • Prev by thread: Re: Random Order of a Set of Numbers
  • Next by thread: Re: Random Order of a Set of Numbers