<commit_before>Random123
=========

This is a Haskell port of counter-based random number generators from `Random123 library <http://www.thesalmons.org/john/random123/>`_ v1.07 (with a minor bugfix).
The description of algorithms can be also found in `Salmon et al., P. Int. C. High. Perform. 16 (2011) <http://dx.doi.org/doi:10.1145/2063384.2063405>`_.


Contributing
------------

When making changes to the library, run (or update, if necessary) functionality tests.
This can be done as

::

    $ cabal configure --enable-tests
    $ cabal build
    $ cabal test

or just by executing ``cd test; ./test.sh``.
You can also check the performance by running benchmarks as

::

    $ cabal configure --enable-benchmarks
    $ cabal build
    $ cabal bench

or by executing ``cd test; ./test_perf.sh``.
Benchmarks will create a report file ``test_perf.html``
in the folder where they were executed from.


TODO
----

* Performance issues:

    * According to Salmon et al., Threefry-4x64 should be the fastest algorithm on CPUs.
      This is not what I'm seeing; need to investigate it further.
      If it is made faster, it should be used as the default bijection for ``CBRNG32/64``
      instead of ``philox4``.

    * ``mulhilo`` function in 64-bit Philox is not optimal in terms of performance.
      It can be made faster given the access to CPU intrinsics.

    * 32-bit Threefry shows suprisingly low performance (see ``Bijection`` benchmark group).

    * In general, there seems to be a lot of optimizations that can be done,
      in particular in terms of strategically placed strictness enforcement.

* Current ``split`` implementation is a quick solution that kind of works
  (much like ``StdGen``'s one).
  A mathematically robust implementation is required
  (and CBRNGs by nature should be well-suited for this).
  Moreover, it would be great to have some tests that could distinguish
  "bad" ``split`` from a "good" one.
<commit_msg>README: the sub-optimal Philox64's mulhilo issue is solved (@Keyholder)<commit_after>Random123
=========

This is a Haskell port of counter-based random number generators from `Random123 library <http://www.thesalmons.org/john/random123/>`_ v1.07 (with a minor bugfix).
The description of algorithms can be also found in `Salmon et al., P. Int. C. High. Perform. 16 (2011) <http://dx.doi.org/doi:10.1145/2063384.2063405>`_.


Contributing
------------

When making changes to the library, run (or update, if necessary) functionality tests.
This can be done as

::

    $ cabal configure --enable-tests
    $ cabal build
    $ cabal test

or just by executing ``cd test; ./test.sh``.
You can also check the performance by running benchmarks as

::

    $ cabal configure --enable-benchmarks
    $ cabal build
    $ cabal bench

or by executing ``cd test; ./test_perf.sh``.
Benchmarks will create a report file ``test_perf.html``
in the folder where they were executed from.


TODO
----

* Performance issues:

    * According to Salmon et al., Threefry-4x64 should be the fastest algorithm on CPUs.
      This is not what I'm seeing; need to investigate it further.
      If it is made faster, it should be used as the default bijection for ``CBRNG32/64``
      instead of ``philox4``.

    * 32-bit Threefry shows suprisingly low performance (see ``Bijection`` benchmark group).

    * In general, there seems to be a lot of optimizations that can be done,
      in particular in terms of strategically placed strictness enforcement.

* Current ``split`` implementation is a quick solution that kind of works
  (much like ``StdGen``'s one).
  A mathematically robust implementation is required
  (and CBRNGs by nature should be well-suited for this).
  Moreover, it would be great to have some tests that could distinguish
  "bad" ``split`` from a "good" one.

{'fraction_non_alphanumeric': 0.09551298871687221, 'fraction_numerical': 0.026239832065074783, 'mean_word_length': 3.381609195402299, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3563011', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1069, 'n_words': 505}