Hi John,
I am not saying it's wrong, but something you could consider trying is using the RVars to generate the random numbers inside MonadRandom and using lift to lift the random number generation into the state Monad and use runStateT. The IO Monad is an instance of MonadRandom so any State + MonadRandom computation can be run inside the IO Monad. I will write a short piece of code to illustrate my point.
import Data.Random.Distribution.Uniform
import Control.Monad.State
import Data.RVar
...
randomState n = do
let
dist = uniform 1 n
rNum <- lift $ sampleRVar dist
put rNum
runStateT (randomState 5) 0
Using RVars, you can generate numbers from numerous distributions. You can even have pure RVars which generate values according to a distribution once an initialization seed is given. I hope this information serves you well. Check out the RVar package in Haskell for more about generating random numbers.
Best,
Ernesto Rodriguez
--
Ernesto Rodriguez
Bachelor of Computer Science - Class of 2013
Jacobs University Bremen