MathGroup Archive 2001

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

Search the Archive

Re: Re: Rearrangement of a sequence into random order


Hello everybody,

Tom De Vries wrote:
> 
> I had this in my files.   It uses Sort and an ordering function....   it's
> probably one of many ways of doing this....  maybe it will do what you need
> it to....
> 
> In[64]:=
> scramble[list_] := Sort[list, (Random[Integer] == 1) &]
> 
> 
> ....

It is a nice exercise to prove that this 'scramble' algorithm
does not give a fair 'random permutation'.
Of course 'RandomPermutation' does.

Wil Kortsmit


  • Prev by Date: PC - Mac Compatibility
  • Next by Date: controlling whether notebook sections open on evaluation
  • Previous by thread: Re: Rearrangement of a sequence into random order
  • Next by thread: Re: Rearrangement of a sequence into random order