packages feed

dice-entropy-conduit-1.0.0.1: dice-entropy-conduit.cabal

name:           dice-entropy-conduit
version:        1.0.0.1
cabal-version:  >=1.8
build-type:     Simple
license:        LGPL-2.1
license-file:   LICENSE
author:         Peter Robinson <peter.robinson@monoid.at>
maintainer:     peter.robinson@monoid.at
copyright:      Peter Robinson 2014
homepage:       http://monoid.at/code
tested-with:    GHC==7.8.3
stability:      experimental
category:       Cryptography, Data 
synopsis:       Cryptographically secure n-sided dice via rejection sampling. 
description:    
   This library uses rejection sampling to provide cryptographically secure 
   @n@-sided dice rolls and random sampling (within a given range). 
   The number of used random bits is close to the information-theoretic optimal
   bound.
   .
   /Usage:/
   .
   If we wanted to use the system-specific entropy source ('systemEntropy') to
   produce 10 dice rolls of a 6-sided dice (i.e. range [0,5]), we could write:
   .
   > > systemEntropy $$ diceRolls 6 =$= CL.take 10 
   > [5,1,3,3,0,5,3,2,2,1]
   .
   The function 'testPerformance' yields the actual number of consumed random
   bits:
   .
   > > testPerformance 12 10000
   > Generated 10000 random samples in range [0,11]
   > Average number of bits used: 3.5904
   > Entropy lower bound on the number of required bits: 3.5849625007211565
   > Performance ratio: 1.0015167520658164
   .
   Feedback is welcome!

library
  hs-source-dirs:  src
  build-depends:   base == 4.*
                  ,bytestring >= 0.9
                  ,entropy >= 0.3.2
                  ,conduit >= 1.1.7
                  ,transformers >= 0.4.0.0

  ghc-options:     -Wall 
  exposed-modules: System.Random.Dice
                   System.Random.Dice.Internal


test-suite Main
  type:            exitcode-stdio-1.0
  x-uses-tf:       true
  build-depends:   base >= 4 && < 5,
                   QuickCheck >= 2.4,
                   test-framework >= 0.4.1,
                   test-framework-quickcheck2
  hs-source-dirs:  src, tests
  main-is:         Tests.hs