Git Product home page Git Product logo

untwist's Introduction

untwist

Maven Central Javadoc Build Status License

untwist is a collection of PRNG's from .NET, Free Pascal, Turbo Pascal, Python.

Python and Free Pascal use the Mersenne Twister as a randomization source. Turbo Pascal and Java are using a linear congruential generator (LCG). .NET is using a modified version of Donald E. Knuth's subtractive random number generator algorithm.

Given the same input (seed) they generate the same values as the ones in the respective languages.

Also, besides their normal use, I have added functions to go backward. The Mersenne Twister and LCG's are reversible. Also, LCG's and subtractive generators are trivial to revert.

I got the idea of reversing the generators from several places, after I had to break the seed of some generator, in order to reduce the size of the archived dataset.

Disclaimer

There are some cases in which the reverse does not work as expected. Try not to mix next and prev versions of the methods as you might run into strange situations. Some of the situations are captured by unit tests which are currently marked as ignored. Most of the time things go well.

Nevertheless, use it at your own risk. This library comes with no guarantees.

Usage

Maven dependency

<dependency>
    <groupId>ro.derbederos</groupId>
    <artifactId>untwist</artifactId>
    <version>0.5</version>
</dependency>

Gradle dependency

compile 'ro.derbederos:untwist:0.5'

Enjoy using them!

untwist's People

Contributors

csoroiu avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mohanrajfinvi

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.