home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / sys / atari / st / 21177 < prev    next >
Encoding:
Text File  |  1993-01-28  |  788 b   |  38 lines

  1. Newsgroups: comp.sys.atari.st
  2. Path: sparky!uunet!email!nino
  3. From: nino@vmars.tuwien.ac.at (Marinos Yannikos)
  4. Subject: Re: Assembler routine that generates random numbers?
  5. Message-ID: <1993Jan28.131923.16697@email.tuwien.ac.at>
  6. Sender: news@email.tuwien.ac.at
  7. Nntp-Posting-Host: gipsy.vmars.tuwien.ac.at
  8. Organization: TU Wien, Vienna, Austria
  9. References: <1993Jan28.120214.19307@cs.hw.ac.uk>
  10. Date: Thu, 28 Jan 1993 13:19:23 GMT
  11. Lines: 25
  12.  
  13. sbrown@cee.hw.ac.uk (Stuart Brown) writes:
  14. : [...] 
  15. : random:
  16. :   move.w seed,d0
  17. :   mulu #109,d0
  18.  
  19. :   add.l #853,d0
  20. -> add.w #853,d0
  21.  
  22. :   divu #4096,d0
  23. :   swap d0
  24. Why not remove these two and use
  25.  
  26.     and.w #4095,d0
  27.  
  28. instead? This will almost halve the time needed to calculate
  29. the random number...
  30.  
  31. :   move.w d0,seed
  32. :   rts
  33. : seed
  34. :   dc.w 0
  35.  
  36. -MY
  37.  
  38.