home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14575 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  2.1 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!caen!kuhub.cc.ukans.edu!husc-news.harvard.edu!tara!fry
  2. Newsgroups: comp.sys.mac.programmer
  3. Subject: Re: Seed for random numbers?
  4. Message-ID: <1992Aug26.185336.15134@husc3.harvard.edu>
  5. From: fry@tara.harvard.edu (David Fry)
  6. Date: 26 Aug 92 18:53:34 EDT
  7. References: <1992Aug26.213810.13252@reed.edu>
  8. Organization: Harvard Math Department
  9. Nntp-Posting-Host: tara.harvard.edu
  10. Lines: 32
  11.  
  12. In article <1992Aug26.213810.13252@reed.edu> bowman@reed.edu (Eric Bowman (bobo)) writes:
  13. >I've written a program that used by a class here that has stochastic elements
  14. >to it.  I've been using the seconds since 1901 deal to seed my random number
  15. >generator; unfortunately, when a class uses it, they get similar seeds and
  16. >(sometimes) near identical results on different machines.  Does anyone have
  17. >a suggestion for how a unique seed for each machine could be created?  I
  18. >don't know AppleTalk yet, but perhaps there is some i.d. associated with
  19. >each machine that could be EORed with the seed?
  20.  
  21. If s1 and s2 are two seeds for the Macintosh random number generator,
  22. then s1 and s2 being close does not imply that the subsequent random
  23. sequences will be "close," whatever that means.  Your phrase
  24. "(sometimes) near identical results" indicates to me that your
  25. stochastic model is just giving similar results for different
  26. sequences.  Certainly this is not uncommon.
  27.  
  28. Unless each Mac is synchronized to the second and the students start
  29. the programs at identical times, they should have different sequences, 
  30. and each pair of sequences is as "different" as any other randomly 
  31. selected pair.  In other words, there's no reason to believe that 
  32. seed=1 and seed=2 will give sequences more similar than seed=1 and 
  33. seed=10000.
  34.  
  35. If this is still unsatisfactory, you could put up a dialog box asking
  36. the students to enter a seed.  Or you could use TickCounts(), which is
  37. the number of 60ths of second since the computer was turned on.
  38.  
  39.  
  40. David Fry                                  fry@math.harvard.edu
  41. Division of Applied Sciences               fry@huma1.bitnet
  42. Harvard University                      ...!harvard!huma1!fry
  43. Cambridge, MA  02138            
  44.