Re: Rearrangement of a sequence into random order
- To: mathgroup at smc.vnet.net
- Subject: [mg28439] Re: Rearrangement of a sequence into random order
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Thu, 19 Apr 2001 03:26:27 -0400 (EDT)
- References: <9bjg9m$gsn@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Loren,
Looking up RandomPermutation in the HelpBrowser , Master Index leads us to
<<DiscreteMath`Permutations`
RandomPermutation[20]
{17,2,18,20,11,13,5,19,8,16,9,3,4,6,15,7,10,1,14,12}
And, more generally,
RP[x_]:=x[[RandomPermutation[Length[x]]]]
RP[H[a,b,c,d,e,f]]
H[e,c,a,b,f,d]
--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565
"Loren Dill" <lorendill at mediaone.net> wrote in message
news:9bjg9m$gsn at smc.vnet.net...
> Hi,
>
> I'm a math teacher, and need to prepare exams from time to time. I
> typically prepare questions for the exam in a sequential order starting at
> the beginning of the material and going to the end. I may have something
> like 20 short-answer questions. I want a program that will randomize the
> order of the questions. In other words, I want to provide n, the number
of
> questions, and have the program provide a list of length n that contains
all
> the numbers from 1 to n in a random order without any number being
repeated
> or omitted. I'm sure that this is an easy task for Mathematica, but I
can't
> figure out the best way to do it.
>
> Loren Dill
>
>