title: Sampling a normal distribution using Control.Monad.MonadRandom
body: <p>I want to sample a Normal distribution with given mean and standard deviation. I know how to do that in various contexts like Data.Random.Rvar or Data.Random.MonadRandom.
  However, the context of my function is Control.Monad.MonadRandom, and I would like to keep it that way as my whole project uses Control.Monad.MonadRandom.</p>
  
  <p>Is there any way to do so, and could you help me do that?</p>
  
  <p>Here is how the code looks like. Pattern is just an alias for Data.Vector Double and Weights is an alias for Data.Vector (Data.Vector Double) (ie a matrix)</p>
  
  <pre><code>train :: MonadRandom m =&gt; [Pattern] -&gt; Int -&gt; m Weights
  train pats nr_hidden = do
    ws_start &lt;- ws_start''
    foldM updateWS ws_start pats
      where ws_start'  = take p (repeat $ take nr_hidden $ repeat $ (normal 0.0 0.01))
           ws_start'' = vector2D &lt;$&gt; (sequence $ map sequence ws_start')
           p = length pats
  </code></pre>
  
  <p>Thank you.</p>