Code Monkey home page Code Monkey logo

elm-random-pcg-extended's Introduction

Elm 0.19

Use the NoRedInk fork

Note

This is a fork, you probably want mgold/elm-random-pcg

Reason of existance

I created this version of the Random library to get more bits of randomness for a random password generator. For this purpose, I created Random.Pcg.Extended, which Implements the extended version of PCG.

In the process of doing this, I made the Random library more general, e.g. with Random.General it is now possible to use your own RNG as a base generator.


Original readme:

Random.Pcg for Elm

"The generation of random numbers is too important to be left to chance." โ€“ Robert R. Coveyou

An alternate random number generator built around four principles:

  • Statistical Quality. If you use any seed less than 53,668 and generate one bool, it will be True โ€“ if you're using core's Random module. More sophisticated statistical tests spot patterns in the "random" numbers almost immediately. Would you want to trust the accuracy of your fuzz tests to such a flawed algorithm? This library produces far less predictable and biased output, especially if you use thousands of random numbers. See test/dieharder for more details.

  • Useful features. This library exports constant and andMap, which are conspicuously absent from core, along with other helpful functions for composing generators. Particularly interesting is independentSeed, which allows for lazy lists and isolated components to generate as much randomness as they need, when they need it.

  • Performance. This library will generate floats about 3.5 times faster than core, and ints do not regress. These figures stand to improve pending some optimizations to the compiler. You can see the full benchmark results.

  • Compatibility. This library is a drop-in replacement for core's Random module. Specifically, you can replace import Random with import Random.Pcg as Random and everything will continue to work. (The one exception is third party libraries like elm-random-extra.)

This is an implementation of PCG by M. E. O'Neil. The generator is not cryptographically secure.

Please report bugs, feature requests, and other issues on GitHub.

Changelog (major versions only)

5.0.0

  • Argument order of andMap flipped.

4.0.0

  • Upgraded for 0.18.
  • Argument order of andThen flipped.

3.0.0

  • Change implementation to use the RXS-M-SH variant of PCG. Now much faster and not much worse statistically.
  • Remove initialSeed2, since there are now only 32 bits of state.
  • Random.Pcg.Interop.fission has been changed to a (core) generator of (PCG) seeds.
  • Add generate to match core 4.x API. Implemented by Richard Feldman.

2.0.0

  • Upgraded for 0.17.
  • generate renamed step to match core 4.x API.
  • Module renamed Random.Pcg from Random.PCG.
  • split has been removed; use independentSeed.
  • minInt and maxInt values changed to match core.

elm-random-pcg-extended's People

Contributors

frankschmitt avatar ianmackenzie avatar mgold avatar nphollon avatar zinggi avatar zwilias avatar

Watchers

 avatar  avatar  avatar

Forkers

noredink

elm-random-pcg-extended's Issues

0.19 upgrade

Hey @Zinggi,

NoRedInk is going to fork this and Zinggi/elm-uuid and publish them for 0.19 so we can finish up our codebase upgrade. Would you like us to also send you pull requests so you can publish your own?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.