#1272: newStdGen returns the same value on successive calls
----------------------+-----------------------------------------------------
 Reporter:  guest     |          Owner:         
     Type:  bug       |         Status:  new    
 Priority:  normal    |      Milestone:         
Component:  Compiler  |        Version:  6.6    
 Severity:  normal    |     Resolution:         
 Keywords:            |     Difficulty:  Unknown
 Testcase:            |   Architecture:  Unknown
       Os:  Unknown   |  
----------------------+-----------------------------------------------------
Comment (by guest):

 {{{
 mkStdRNG :: Integer -> IO StdGen
 mkStdRNG o = do
     ct          <- getCPUTime
     (TOD sec _) <- getClockTime
     return (createStdGen (sec * 12345 + ct + o))
 }}}

 The problem here is that {{{getCPUTime}}} often returns zero.  Possibly
 because this happens at the start of the program, and with too low
 resolution.  Experimenting a bit, it appears that the smallest non-zero
 value for getCPUTime is 4*10^9, i.e. a resolution of 4ms?

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1272>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to