# dice-entropy-conduit: Cryptographically secure n-sided dice via rejection sampling.

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!

Versions [faq] | 1.0.0.0, 1.0.0.1 |
---|---|

Dependencies | base (==4.*), bytestring (>=0.9), conduit (>=1.1.7), entropy (>=0.3.2), transformers (>=0.4.0.0) [details] |

License | LGPL-2.1-only |

Copyright | Peter Robinson 2014 |

Author | Peter Robinson <peter.robinson@monoid.at> |

Maintainer | peter.robinson@monoid.at |

Category | Cryptography, Data |

Home page | http://monoid.at/code |

Uploaded | by PeterRobinson at Tue Sep 9 15:51:05 UTC 2014 |

Distributions | Debian:1.0.0.1, NixOS:1.0.0.1 |

Downloads | 1555 total (86 in the last 30 days) |

Rating | (no votes yet) [estimated by Bayesian average] |

Your Rating | |

Status | Docs uploaded by user Build status unknown [no reports yet] |

## Downloads

- dice-entropy-conduit-1.0.0.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)