home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / sci / math / symbolic / 2236 < prev    next >
Encoding:
Internet Message Format  |  1992-08-20  |  1.4 KB

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