Hi, friends
the following function works well
rollDice n = getStdRandom (randomR (1,n)) :: IO Int

now i want to use /dev/random to produce better random number, but it doesnot 
work
rollDice_t n = do
    hd <- openFile "/dev/random" ReadMode
    v <-  B.hGet hd 1
    return (v `mod` n) + 1

 No instance for (Integral B.ByteString)
      arising from a use of `mod' at Money.hs:15:12-20
    Possible fix:
      add an instance declaration for (Integral B.ByteString)
    In the first argument of `return', namely `(v `mod` n)'
    In the first argument of `(+)', namely `return (v `mod` n)'
    In the expression: return (v `mod` n) + 1

then how to use the ByteString properly ?

Sincerely!
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to