random-source: Generic basis for random number generators

[ deprecated, library, math, public-domain ] [ Propose Tags ] [ Report a vulnerability ]
Deprecated

Random number generation based on entropy sources able to produce a small but well-defined set of primitive variates. Also includes facilities for "completing" partial implementations, making it easy to define new entropy sources in a way that is naturally forward-compatible. Now DEPRECATED: see README for further details.


[Skip to Readme]

Modules

[Last Documentation]

  • Data
    • Random
      • Internal
        • Data.Random.Internal.Source
        • Data.Random.Internal.Words
      • Data.Random.Source
        • Data.Random.Source.DevRandom
        • Data.Random.Source.IO
        • Data.Random.Source.MWC
        • Data.Random.Source.PureMT
        • Data.Random.Source.Std
        • Data.Random.Source.StdGen

Flags

Automatic Flags
NameDescriptionDefault
base4

base-4 and above do not include syb

Enabled
mtl2

mtl-2 has State, etc., as "type" rather than "newtype"

Enabled

Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.3, 0.3.0.2, 0.3.0.4, 0.3.0.5, 0.3.0.6, 0.3.0.8, 0.3.0.10, 0.3.0.11, 0.3.0.12, 0.3.0.13 (info)
Change log changelog.md
Dependencies base (>=3 && <4.16), flexible-defaults (>=0.0.0.2), mersenne-random-pure64, mtl (>=1 && <2 || >=2.0 && <2.3), mwc-random, primitive, random (>=1.2.0 && <1.3), stateref (>=0.3 && <0.4), syb, template-haskell, th-extras [details]
Tested with ghc ==7.4.2, ghc ==7.6.1
License LicenseRef-PublicDomain
Author James Cook <mokus@deepbondi.net>
Maintainer James Cook <mokus@deepbondi.net>
Category Math
Home page https://github.com/mokus0/random-fu
Source repo head: git clone https://github.com/mokus0/random-fu.git(random-source)
Uploaded by DominicSteinitz at 2023-09-14T09:30:28Z
Distributions Debian:0.3.0.8
Reverse Dependencies 23 direct, 44 indirect [details]
Downloads 12926 total (29 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs not available [build log]
All reported builds failed as of 2023-09-14 [all 2 reports]

Readme for random-source-0.3.0.13

[back to package description]

This is now deprecated and it is better to use the random package as the source of randomness.

Here's what you might have written before:

import qualified Data.Random as Random
import qualified Data.Random.Distribution.Bernoulli as Bernoulli

main :: IO ()
main = do
  x <- Random.sample $ Bernoulli.Bernoulli (0.5 :: Double) :: IO Double
  print x

And here's what you should write now (but there are many other options):

import qualified System.Random.Stateful as Random.Stateful
import qualified Data.Random as Random
import qualified Data.Random.Distribution.Bernoulli as Bernoulli
import qualified Control.Monad.Reader as Reader

main :: IO ()
main = do
  stdgen <- Random.Stateful.newIOGenM =<< Random.Stateful.newStdGen
  x <- Reader.runReaderT (Random.sample $ Bernoulli.Bernoulli (0.5 :: Double)) stdgen
        :: IO Double
  print x