module Simulation.Aivika.Stream.Random
(randomUniformStream,
randomNormalStream,
randomExponentialStream,
randomErlangStream,
randomPoissonStream,
randomBinomialStream) where
import System.Random
import Control.Monad.Trans
import Simulation.Aivika.Parameter
import Simulation.Aivika.Parameter.Random
import Simulation.Aivika.Simulation
import Simulation.Aivika.Dynamics
import Simulation.Aivika.Process
import Simulation.Aivika.Stream
randomUniformStream :: Double
-> Double
-> Stream Double
randomUniformStream min max = Cons z where
z = do delay <- liftParameter $ randomUniform min max
holdProcess delay
return (delay, randomUniformStream min max)
randomNormalStream :: Double
-> Double
-> Stream Double
randomNormalStream mu nu = Cons z where
z = do delay <- liftParameter $ randomNormal mu nu
holdProcess delay
return (delay, randomNormalStream mu nu)
randomExponentialStream :: Double
-> Stream Double
randomExponentialStream mu = Cons z where
z = do delay <- liftParameter $ randomExponential mu
holdProcess delay
return (delay, randomExponentialStream mu)
randomErlangStream :: Double
-> Int
-> Stream Double
randomErlangStream beta m = Cons z where
z = do delay <- liftParameter $ randomErlang beta m
holdProcess delay
return (delay, randomErlangStream beta m)
randomPoissonStream :: Double
-> Stream Int
randomPoissonStream mu = Cons z where
z = do delay <- liftParameter $ randomPoisson mu
holdProcess $ fromIntegral delay
return (delay, randomPoissonStream mu)
randomBinomialStream :: Double
-> Int
-> Stream Int
randomBinomialStream prob trials = Cons z where
z = do delay <- liftParameter $ randomBinomial prob trials
holdProcess $ fromIntegral delay
return (delay, randomBinomialStream prob trials)