MathGroup Archive 1998

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

Search the Archive

Re: Random Order of a Set of Numbers



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
____________________________________________________________________



  • Prev by Date: Re: question on ErrorBar
  • Next by Date: Re: Xresources for Mathematica
  • Prev by thread: Re: Random Order of a Set of Numbers
  • Next by thread: Comparison of Mathematica on Various Computers