home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / atari / st / 13283 < prev    next >
Encoding:
Internet Message Format  |  1992-09-07  |  1.4 KB

  1. Path: sparky!uunet!mcsun!uknet!gdt!aber!hrs
  2. From: hrs@aber.ac.uk (Herbert Martin Sauro)
  3. Newsgroups: comp.sys.atari.st,comp.sys.atari.tech
  4. Subject: Bug in Lattice 5.5 rand() function (Not in 5.0)
  5. Message-ID: <1992Sep4.194915.10758@aber.ac.uk>
  6. Date: 4 Sep 92 19:49:15 GMT
  7. Organization: University of Wales, Aberystwyth
  8. Lines: 19
  9.  
  10. I think I have spotted a bug in the random number generator (rand())
  11. of Lattice 5.5 which is not present in their earlier version 5.0.
  12. rand() in 5.0 returns a long value with the range 0 to 2^31. RAND_MAX
  13. is also 2^31. BUT in 5.5 rand() returns a long with the range 0 to 2^16
  14. but RAND_MAX is still 2^31. Obviously this is wrong unless of course
  15. I'm doing something wrong. I did check though the rand.o objects
  16. from both 5.0 and 5.5 using omd (dissassembler) and found that
  17. the 5.5 version was doing a 'clr.w d0; swap d0' before returning to
  18. the caller which would explain why the top 16 bits are zero.
  19. The rand() version from 5.0 doesn't do this. Anybody had any experience
  20. of this? As a temp measure I've whipped out rand() from 5.0 and am
  21. using it with 5.5. Hisoft are you reading this?
  22.  
  23. Herb
  24. -- 
  25. /******************************************************************************
  26. Herbert Sauro                                   e-mail: hrs@aber.ac.uk
  27. Biological Sciences                              phone: +44 970 622353
  28. Univesity College of Wales                                                    
  29.