Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: shuffling a deck of cards

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31802] Re: shuffling a deck of cards
  • From: atelesforos at hotmail.com (Orestis Vantzos)
  • Date: Sun, 2 Dec 2001 04:25:40 -0500 (EST)
  • References: <9ua3bv$17h$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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