module Simulation.Aivika.Trans.Signal.Random
(
newRandomSignal,
newRandomUniformSignal,
newRandomUniformIntSignal,
newRandomTriangularSignal,
newRandomNormalSignal,
newRandomLogNormalSignal,
newRandomExponentialSignal,
newRandomErlangSignal,
newRandomPoissonSignal,
newRandomBinomialSignal,
newRandomGammaSignal,
newRandomBetaSignal,
newRandomWeibullSignal,
newRandomDiscreteSignal) where
import Control.Monad
import Control.Monad.Trans
import Simulation.Aivika.Trans.DES
import Simulation.Aivika.Trans.Generator
import Simulation.Aivika.Trans.Parameter
import Simulation.Aivika.Trans.Parameter.Random
import Simulation.Aivika.Trans.Simulation
import Simulation.Aivika.Trans.Dynamics
import Simulation.Aivika.Trans.Event
import Simulation.Aivika.Trans.Composite
import Simulation.Aivika.Trans.Process
import Simulation.Aivika.Trans.Signal
import Simulation.Aivika.Trans.Statistics
import Simulation.Aivika.Trans.Arrival
newRandomSignal :: MonadDES m
=> Parameter m (Double, a)
-> Composite m (Signal m (Arrival a))
{-# INLINABLE newRandomSignal #-}
newRandomSignal :: forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal Parameter m (Double, a)
delay =
do SignalSource m (Arrival a)
source <- Simulation m (SignalSource m (Arrival a))
-> Composite m (SignalSource m (Arrival a))
forall a. Simulation m a -> Composite m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
SimulationLift t m =>
Simulation m a -> t m a
liftSimulation Simulation m (SignalSource m (Arrival a))
forall (m :: * -> *) a.
MonadDES m =>
Simulation m (SignalSource m a)
newSignalSource
let loop :: Maybe Double -> Process m b
loop Maybe Double
t0 =
do (Double
delay, a
a) <- Parameter m (Double, a) -> Process m (Double, a)
forall a. Parameter m a -> Process m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
ParameterLift t m =>
Parameter m a -> t m a
liftParameter Parameter m (Double, a)
delay
Bool -> Process m () -> Process m ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Double
delay Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
> Double
0) (Process m () -> Process m ()) -> Process m () -> Process m ()
forall a b. (a -> b) -> a -> b
$
Double -> Process m ()
forall (m :: * -> *). MonadDES m => Double -> Process m ()
holdProcess Double
delay
Double
t2 <- Dynamics m Double -> Process m Double
forall a. Dynamics m a -> Process m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
DynamicsLift t m =>
Dynamics m a -> t m a
liftDynamics Dynamics m Double
forall (m :: * -> *). Monad m => Dynamics m Double
time
let arrival :: Arrival a
arrival = Arrival { arrivalValue :: a
arrivalValue = a
a,
arrivalTime :: Double
arrivalTime = Double
t2,
arrivalDelay :: Maybe Double
arrivalDelay =
case Maybe Double
t0 of
Maybe Double
Nothing -> Maybe Double
forall a. Maybe a
Nothing
Just Double
t0 -> Double -> Maybe Double
forall a. a -> Maybe a
Just Double
delay }
Event m () -> Process m ()
forall a. Event m a -> Process m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
EventLift t m =>
Event m a -> t m a
liftEvent (Event m () -> Process m ()) -> Event m () -> Process m ()
forall a b. (a -> b) -> a -> b
$
SignalSource m (Arrival a) -> Arrival a -> Event m ()
forall (m :: * -> *) a. SignalSource m a -> a -> Event m ()
triggerSignal SignalSource m (Arrival a)
source Arrival a
arrival
Maybe Double -> Process m b
loop (Double -> Maybe Double
forall a. a -> Maybe a
Just Double
t2)
ProcessId m
pid <- Simulation m (ProcessId m) -> Composite m (ProcessId m)
forall a. Simulation m a -> Composite m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
SimulationLift t m =>
Simulation m a -> t m a
liftSimulation Simulation m (ProcessId m)
forall (m :: * -> *). MonadDES m => Simulation m (ProcessId m)
newProcessId
Event m () -> Composite m ()
forall a. Event m a -> Composite m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
EventLift t m =>
Event m a -> t m a
liftEvent (Event m () -> Composite m ()) -> Event m () -> Composite m ()
forall a b. (a -> b) -> a -> b
$
ProcessId m -> Process m () -> Event m ()
forall (m :: * -> *).
MonadDES m =>
ProcessId m -> Process m () -> Event m ()
runProcessUsingId ProcessId m
pid (Process m () -> Event m ()) -> Process m () -> Event m ()
forall a b. (a -> b) -> a -> b
$
Maybe Double -> Process m ()
forall {b}. Maybe Double -> Process m b
loop Maybe Double
forall a. Maybe a
Nothing
DisposableEvent m -> Composite m ()
forall (m :: * -> *).
Monad m =>
DisposableEvent m -> Composite m ()
disposableComposite (DisposableEvent m -> Composite m ())
-> DisposableEvent m -> Composite m ()
forall a b. (a -> b) -> a -> b
$
Event m () -> DisposableEvent m
forall (m :: * -> *). Event m () -> DisposableEvent m
DisposableEvent (Event m () -> DisposableEvent m)
-> Event m () -> DisposableEvent m
forall a b. (a -> b) -> a -> b
$
ProcessId m -> Event m ()
forall (m :: * -> *). MonadDES m => ProcessId m -> Event m ()
cancelProcessWithId ProcessId m
pid
Signal m (Arrival a) -> Composite m (Signal m (Arrival a))
forall a. a -> Composite m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Signal m (Arrival a) -> Composite m (Signal m (Arrival a)))
-> Signal m (Arrival a) -> Composite m (Signal m (Arrival a))
forall a b. (a -> b) -> a -> b
$ SignalSource m (Arrival a) -> Signal m (Arrival a)
forall (m :: * -> *) a. SignalSource m a -> Signal m a
publishSignal SignalSource m (Arrival a)
source
newRandomUniformSignal :: MonadDES m
=> Double
-> Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomUniformSignal #-}
newRandomUniformSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Composite m (Signal m (Arrival Double))
newRandomUniformSignal Double
min Double
max =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomUniform Double
min Double
max Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomUniformIntSignal :: MonadDES m
=> Int
-> Int
-> Composite m (Signal m (Arrival Int))
{-# INLINABLE newRandomUniformIntSignal #-}
newRandomUniformIntSignal :: forall (m :: * -> *).
MonadDES m =>
Int -> Int -> Composite m (Signal m (Arrival Int))
newRandomUniformIntSignal Int
min Int
max =
Parameter m (Double, Int) -> Composite m (Signal m (Arrival Int))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Int) -> Composite m (Signal m (Arrival Int)))
-> Parameter m (Double, Int)
-> Composite m (Signal m (Arrival Int))
forall a b. (a -> b) -> a -> b
$
Int -> Int -> Parameter m Int
forall (m :: * -> *). MonadComp m => Int -> Int -> Parameter m Int
randomUniformInt Int
min Int
max Parameter m Int
-> (Int -> Parameter m (Double, Int)) -> Parameter m (Double, Int)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
x ->
(Double, Int) -> Parameter m (Double, Int)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int
x)
newRandomTriangularSignal :: MonadDES m
=> Double
-> Double
-> Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomTriangularSignal #-}
newRandomTriangularSignal :: forall (m :: * -> *).
MonadDES m =>
Double
-> Double -> Double -> Composite m (Signal m (Arrival Double))
newRandomTriangularSignal Double
min Double
median Double
max =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Double -> Parameter m Double
randomTriangular Double
min Double
median Double
max Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomNormalSignal :: MonadDES m
=> Double
-> Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomNormalSignal #-}
newRandomNormalSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Composite m (Signal m (Arrival Double))
newRandomNormalSignal Double
mu Double
nu =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomNormal Double
mu Double
nu Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomLogNormalSignal :: MonadDES m
=> Double
-> Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomLogNormalSignal #-}
newRandomLogNormalSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Composite m (Signal m (Arrival Double))
newRandomLogNormalSignal Double
mu Double
nu =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomLogNormal Double
mu Double
nu Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomExponentialSignal :: MonadDES m
=> Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomExponentialSignal #-}
newRandomExponentialSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Composite m (Signal m (Arrival Double))
newRandomExponentialSignal Double
mu =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Parameter m Double
forall (m :: * -> *). MonadComp m => Double -> Parameter m Double
randomExponential Double
mu Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomErlangSignal :: MonadDES m
=> Double
-> Int
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomErlangSignal #-}
newRandomErlangSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Int -> Composite m (Signal m (Arrival Double))
newRandomErlangSignal Double
beta Int
m =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Int -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Double
randomErlang Double
beta Int
m Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomPoissonSignal :: MonadDES m
=> Double
-> Composite m (Signal m (Arrival Int))
{-# INLINABLE newRandomPoissonSignal #-}
newRandomPoissonSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Composite m (Signal m (Arrival Int))
newRandomPoissonSignal Double
mu =
Parameter m (Double, Int) -> Composite m (Signal m (Arrival Int))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Int) -> Composite m (Signal m (Arrival Int)))
-> Parameter m (Double, Int)
-> Composite m (Signal m (Arrival Int))
forall a b. (a -> b) -> a -> b
$
Double -> Parameter m Int
forall (m :: * -> *). MonadComp m => Double -> Parameter m Int
randomPoisson Double
mu Parameter m Int
-> (Int -> Parameter m (Double, Int)) -> Parameter m (Double, Int)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
x ->
(Double, Int) -> Parameter m (Double, Int)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int
x)
newRandomBinomialSignal :: MonadDES m
=> Double
-> Int
-> Composite m (Signal m (Arrival Int))
{-# INLINABLE newRandomBinomialSignal #-}
newRandomBinomialSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Int -> Composite m (Signal m (Arrival Int))
newRandomBinomialSignal Double
prob Int
trials =
Parameter m (Double, Int) -> Composite m (Signal m (Arrival Int))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Int) -> Composite m (Signal m (Arrival Int)))
-> Parameter m (Double, Int)
-> Composite m (Signal m (Arrival Int))
forall a b. (a -> b) -> a -> b
$
Double -> Int -> Parameter m Int
forall (m :: * -> *).
MonadComp m =>
Double -> Int -> Parameter m Int
randomBinomial Double
prob Int
trials Parameter m Int
-> (Int -> Parameter m (Double, Int)) -> Parameter m (Double, Int)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Int
x ->
(Double, Int) -> Parameter m (Double, Int)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
x, Int
x)
newRandomGammaSignal :: MonadDES m
=> Double
-> Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomGammaSignal #-}
newRandomGammaSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Composite m (Signal m (Arrival Double))
newRandomGammaSignal Double
kappa Double
theta =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomGamma Double
kappa Double
theta Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomBetaSignal :: MonadDES m
=> Double
-> Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomBetaSignal #-}
newRandomBetaSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Composite m (Signal m (Arrival Double))
newRandomBetaSignal Double
alpha Double
beta =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomBeta Double
alpha Double
beta Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomWeibullSignal :: MonadDES m
=> Double
-> Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomWeibullSignal #-}
newRandomWeibullSignal :: forall (m :: * -> *).
MonadDES m =>
Double -> Double -> Composite m (Signal m (Arrival Double))
newRandomWeibullSignal Double
alpha Double
beta =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
Double -> Double -> Parameter m Double
forall (m :: * -> *).
MonadComp m =>
Double -> Double -> Parameter m Double
randomWeibull Double
alpha Double
beta Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)
newRandomDiscreteSignal :: MonadDES m
=> DiscretePDF Double
-> Composite m (Signal m (Arrival Double))
{-# INLINABLE newRandomDiscreteSignal #-}
newRandomDiscreteSignal :: forall (m :: * -> *).
MonadDES m =>
DiscretePDF Double -> Composite m (Signal m (Arrival Double))
newRandomDiscreteSignal DiscretePDF Double
dpdf =
Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall (m :: * -> *) a.
MonadDES m =>
Parameter m (Double, a) -> Composite m (Signal m (Arrival a))
newRandomSignal (Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double)))
-> Parameter m (Double, Double)
-> Composite m (Signal m (Arrival Double))
forall a b. (a -> b) -> a -> b
$
DiscretePDF Double -> Parameter m Double
forall (m :: * -> *) a.
MonadComp m =>
DiscretePDF a -> Parameter m a
randomDiscrete DiscretePDF Double
dpdf Parameter m Double
-> (Double -> Parameter m (Double, Double))
-> Parameter m (Double, Double)
forall a b. Parameter m a -> (a -> Parameter m b) -> Parameter m b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \Double
x ->
(Double, Double) -> Parameter m (Double, Double)
forall a. a -> Parameter m a
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
x, Double
x)