import PrelBase
import PrelArr
import Time (getClockTime, ClockTime(..))
-#else
#endif
import Char ( isSpace, chr, ord )
\end{code}
\begin{code}
#ifdef __HUGS__
--- TODO: Hugs/setStdGen
+
setStdGen :: StdGen -> IO ()
-setStdGen sgen = error "not currently implemented in Stg Hugs"
+setStdGen sgen = writeIORef theStdGen sgen
--- TODO: Hugs/getStdGen
getStdGen :: IO StdGen
-getStdGen = error "not currently implemented in Stg Hugs"
+getStdGen = readIORef theStdGen
+
+theStdGen :: IORef StdGen
+theStdGen = primRunST (newIORef (createStdGen 0))
+
#else
+
global_rng :: MutableVar RealWorld StdGen
global_rng = unsafePerformIO $ do
rng <- mkStdRNG 0
getStdGen :: IO StdGen
getStdGen = stToIO (readVar global_rng)
+
#endif