Copyright | (c) George Ungureanu 2020 |
---|---|

License | BSD-style (see the file LICENSE) |

Maintainer | ugeorge@kth.se |

Stability | experimental |

Portability | portable |

Safe Haskell | Safe |

Language | Haskell2010 |

This module defines recipes for uniformly distributed random variables. Wraps utilities imported from System.Random.

# Recipes

uniform :: Random a => Dist a Source #

Recipe for uniformly distributed over all possible values of that type.

`>>>`

`gen <- getStdGen`

`>>>`

`let x = uniform :: Dist Float`

`>>>`

`let hx = histogram (-0.5) 1.5 0.1 $ samplesn gen 10000 x`

`>>>`

Dumped hist1 in ./fig ["./fig/hist1.dat"]`dumpDat $ prepare defaultCfg hx`

:: Random a | |

=> a | lower bound |

-> a | upper bound |

-> Dist a |

Recipe for uniformly distributed over a provided range.

`>>>`

`gen <- getStdGen`

`>>>`

`let x = uniformR 0 20 :: Dist Int`

`>>>`

`let hx = histogram (-1) 21 1 $ samplesn gen 10000 x`

`>>>`

Dumped hist1 in ./fig ["./fig/hist1.dat"]`dumpDat $ prepare defaultCfg hx`

Recipe for uniformly distributed over a range determined by standard deviation.

`>>>`

`gen <- getStdGen`

`>>>`

`let x = uniformD 5 0.5 :: Dist Float`

`>>>`

`let hx = histogram 4 6 0.1 $ samplesn gen 10000 x`

`>>>`

Dumped hist1 in ./fig ["./fig/hist1.dat"]`dumpDat $ prepare defaultCfg hx`

# Layer

The ForSyDe.Atom.Prob module is re-exported for convenience, so it does not need to be imported explicitly.

module ForSyDe.Atom.Prob