MathGroup Archive 2001

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

Search the Archive

Re: shuffling a deck of cards


singleShuffle[list_] := Sort[list, Function[If[Random[] > .5, True, False]]]
This function will "shuffle" any list using Sort.
You probably ought to nest it a couple of times to get better results.
As in betterShuffle[list_,n_:5]:=Nest[singleShuffle,list,n]
Orestis


  • Prev by Date: Re: OOP Revisited
  • Next by Date: List Assignment Question
  • Previous by thread: Re: shuffling a deck of cards
  • Next by thread: Re: shuffling a deck of cards