home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!mm-mac19.mse.uiuc.edu!gaylord
- From: gaylord@ux1.cso.uiuc.edu (Richard J. Gaylord)
- Newsgroups: sci.math.symbolic
- Subject: select from list with & w/o replacement
- Message-ID: <BtABsD.Cpt@news.cso.uiuc.edu>
- Date: 20 Aug 92 13:50:36 GMT
- Article-I.D.: news.BtABsD.Cpt
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: University of Illinois
- Lines: 21
- X-Xxdate: Thu, 20 Aug 92 08:51:18 GMT
- X-Useragent: Nuntius v1.1.1d8
- X-Xxmessage-Id: <A6B90D8661029B13@mm-mac19.mse.uiuc.edu>
-
- just waiting to go to a meeting to discuss (1) the teaching of the
- required introductory cs course for all engineering students using
- Mathematica (2) the teaching of calculus with Mathematica (3) using
- Mathematica as an alternative language to FORTRAN, C and Pascal for
- engineering students [all of this is actually taking place on the U. of
- I. campus right now (not to mention the other 3 or 4 courses being taught
- on campus using Mathematica)].
-
- any way, i'd thought i'd finish up the 'choose from a list' problem by
- putting both the deal [choose without replacement] and the 'choose with
- replacement' programs in the same message.
-
- chooseWithReplacement[list_, n_Integer] :=
- list[[ Table[Random[Integer,{1,Length[list]}],{n}] ]]
-
- deal[lis_List,n_Integer] :=
- Complement[lis, Nest[Delete[#,Random[Integer,{1,Length[#]}]]&,lis,n]]
-
- these are the most straightforward one i can come up with.
-
- any alternatives?
-