Re: Random Order of a Set of Numbers
- To: mathgroup@smc.vnet.net
- Subject: [mg10885] Re: Random Order of a Set of Numbers
- From: Paul Abbott <paul@physics.uwa.edu.au>
- Date: Thu, 12 Feb 1998 20:15:18 -0500
- Organization: University of Western Australia
- References: <6bpvg8$b3j@smc.vnet.net>
JD Faith wrote: > I'm a math moron looking for a formula to compute the following > problem: 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. You could use any of the RandomPermutation* functions in the Combinatorica package: In[1]:= <<DiscreteMath`Combinatorica` ?RandomPermutation "RandomPermutation[n] gives a random permutation of n elements." ?RandomPermutation1 "RandomPermutation1[n] sorts random numbers to generate a random permutation." ?RandomPermutation2 "RandomPermutation2[n] uses random transpositions to generate random \ permutations." In[2]:= RandomPermutation[36] Out[2]={3,4,9,6,16,10,5,12,35,33,22,28,8,2,11,14,27,24,29,21,20,\ 34,23,7,36,25,19,13,1,17,30,31,18,15,26,32} Cheers, Paul ____________________________________________________________________ Paul Abbott Phone: +61-8-9380-2734 Department of Physics Fax: +61-8-9380-1014 The University of Western Australia Nedlands WA 6907 mailto:paul@physics.uwa.edu.au AUSTRALIA http://www.pd.uwa.edu.au/~paul God IS a weakly left-handed dice player ____________________________________________________________________