<commit_before># php-dprng

Generate deterministic pesudo-random numbers, increase the seucrity of `rand()`. This implementation is particularly helpful when deterministic random sequences are required to be consistent across multiple platforms and languages. It relys only on simple bit operations that can easily be implemented consistently across many scripting languages (e.g. JavaScript, Python, PHP, Ruby)

A JavaScript implementation that generates equal sequences for the same salts/seeds can be found [here](//github.com/tmarsteel/jsdprng)

Please contribute with your own implementation in your favourite language! A description of the algorithm and test vectors can be found in [algorithm.md](algorithm.md). I`ll cross-link compliant forks :)

## Usage
```php
use tmarsteel\dprng\DPRNG;

// secure random numbers (seeded from mcrypt_create_iv() if available, rand() otherwise)
$rng = new DPRNG();

// deterministic random sequence
$seed = 0xA2F38C0;
$rng = new DPRNG($seed); 
<commit_msg>Corrected reference to js-dprng<commit_after># php-dprng

Generate deterministic pesudo-random numbers, increase the seucrity of `rand()`. This implementation is particularly helpful when deterministic random sequences are required to be consistent across multiple platforms and languages. It relys only on simple bit operations that can easily be implemented consistently across many scripting languages (e.g. JavaScript, Python, PHP, Ruby)

A JavaScript implementation that generates equal sequences for the same salts/seeds can be found [here](//github.com/tmarsteel/js-dprng)

Please contribute with your own implementation in your favourite language! A description of the algorithm and test vectors can be found in [algorithm.md](algorithm.md). I`ll cross-link compliant forks :)

## Usage
```php
use tmarsteel\dprng\DPRNG;

// secure random numbers (seeded from mcrypt_create_iv() if available, rand() otherwise)
$rng = new DPRNG();

// deterministic random sequence
$seed = 0xA2F38C0;
$rng = new DPRNG($seed); 

{'fraction_non_alphanumeric': 0.07535944471988101, 'fraction_numerical': 0.00495785820525533, 'mean_word_length': 5.386075949367089, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '4273105', 'n_tokens_mistral': 545, 'n_tokens_neox': 520, 'n_words': 241}