random-source: Generic basis for random number generators

[ deprecated, library, math, public-domain ] [ Propose Tags ]

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]


[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


Automatic Flags

base-4 and above do not include syb


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


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


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS] 0.3,,,,,,,,, (info)
Change log changelog.md
Dependencies base (>=3 && <4.16), flexible-defaults (>=, 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]
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:
Reverse Dependencies 23 direct, 44 indirect [details]
Downloads 12746 total (28 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-

[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