home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / pcc / v08n03 / math.exe / SHUFFLE2.ZIP / SHUFFLE2.DOC < prev   
Text File  |  1992-12-03  |  2KB  |  63 lines

  1. SHUFFLE2
  2.  
  3. We're talking conglamorates here, folks.
  4.  
  5. First SHUFFLE.C (from SIMTEL20's SHUFFLE.ZIP), written by:
  6.     David Wesson, PhD.
  7.     Newcastle Business School
  8.     MKU2@UK.AC.NEWCASTLE-POLY.VAXA
  9.  
  10. (More glory to the good Doctor for the idea.)
  11.  
  12. Then a handy random number generator cribbed from a FIDO 8086 Echo msg.
  13. (The Lou Ciriello msg in the source)
  14.  
  15. Then a clean way to seed our random number generator from the
  16. real-time clock (the Nick Downing msg in the source).
  17.  
  18. Then a chunk of ItoA from one place, and an AtoI from somewhere else
  19. (since the AtoI from the first package was horrible and only 8-bit).
  20.  
  21. Mix thoroughly; add some specific stuff (like the STDOUT output
  22. w/linewrap while we're doing our ItoA conversion); optimize here and
  23. there; put as much as possible on silicon (e.g. in registers rather
  24. than in memory).
  25.  
  26. Bake at 350 degrees for 45 minutes, serve warm.
  27.  
  28. Additions to the basic concept:
  29.  
  30.  - Check to see exactly how much room we have for our array
  31.    numbers (rather than an arbitrary "10000" limit as in SHUFFLE.C).
  32.  
  33.  - Increase the padding for each number up to 6 spaces (so we can now
  34.    display numbers bigger than 9999).
  35.  
  36.  - Display "Press any key to abort" to STDERR so it doesn't end up
  37.    being redirected to a file or device or something.  (I'd imagine
  38.    output would be redirected to a file, since you can't do much
  39.    with a stream of numbers on the screen.  In that case, *all*
  40.    you'd want in that output would be numbers, right?)
  41.  
  42.  - The .ASM source is now smaller than the C executable!
  43.  
  44.  
  45. Timing Results (in seconds) running SHUFFLE.EXE and SHUFFLE2.COM
  46. (hadda call it *something* different, eh?) with "1 9999" parameters.
  47.  
  48.         STDOUT    NUL
  49. SHUFFLE.EXE    55.81    17.08
  50. SHUFFLE2.COM    50.21     8.95
  51.  
  52. You can see how screen output significantly slowed them both down.
  53. But when you redirect to NUL .. hoo boy!  No more feelthy output,
  54. and the benefits of hand-coded assembly language show clearly.
  55.  
  56.  
  57. Seems to work just fine.  Get back to me if you find a bug.
  58.  
  59. Released to the public domain.
  60. David Kirschbaum
  61. Toad Hall
  62. kirsch@sesi.com
  63.