home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 7728 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.6 KB

  1. Path: dispatch.news.demon.net!demon!summat.demon.co.uk
  2. From: mike@summat.demon.co.uk (Mike Dodd)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Randomness
  5. Date: Sun, 21 Apr 1996 14:42:56 GMT
  6. Message-ID: <1160.6685T814T1100@summat.demon.co.uk>
  7. References: <451.6681T677T994@summat.demon.co.uk> <4lavaq$i30@louhi.kempele.fi>
  8. NNTP-Posting-Host: summat.demon.co.uk
  9. X-NNTP-Posting-Host: summat.demon.co.uk
  10. X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
  11.  
  12.  
  13. Mike staggered back from the pub and slurred to Jarkko Vatjus-Anttila:
  14.  
  15.  JV> rndnumber
  16.  JV>  move.w seed,d1
  17.  JV>  mulu.w #31421,d1
  18.  JV>  add.w  #6927,d1
  19.  JV>  mulu.w d1,d0
  20.  JV>  move.w d1,seed  ; init new seed to make sure that numbers remain random 
  21.  JV>  clr.w  d0
  22.  JV>  swap   d0       ; upper 16 bits are the most random.
  23.  JV>  rts
  24.  
  25.  JV>: but this produces a rather poor sequence of values...Soooerh, any bette
  26.  JV>: suggestions ?
  27.  
  28.  JV> What do you think of mine?
  29.  
  30. Thanks for your help, also, thanks to everyone else who responded to my original
  31. plea. I'm now having a look at a routine provided by Andrew Bennet which seems
  32. suitable for my needs.
  33.  
  34. As for your own routine - I've not actually tried it - I'm sure it provides good
  35. results but I feel that it might be a little less efficient for the purposes I'm
  36. trying to use it for, compared with the routine I'm now using, with respect to
  37. execution speed and register usage (it would be called many times within each
  38. frame of a game I'm writing, and so needs to be optimised for speed as much as
  39. possible).
  40.  
  41. Once again, thanks for your help.
  42.  
  43. --
  44. Mike    (mike@summat.demon.co.uk | fidonet@2:2500/73.10)
  45.  
  46.  
  47.