Download the PHP package tmarsteel/dprng without Composer

On this page you can find all versions of the php package tmarsteel/dprng. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package dprng

php-dprng

Implementation of a DPRNG algorithm aimed at being simple to implement in almost any general-purpose programming language. Its intended use are simple games; scenarios where a pseudo-random sequence has to be replayed deterministically with low memory and computational cost. The algorithm is not secure. DO NOT USE THIS FOR SECURITY RELATED TASKS.

A JavaScript implementation that generates equal sequences for the same salts/seeds can be found here

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

Installation & Usage

composer require tmarsteel/php-dprng:1.* or just download the single class file.

Entropy / Randomness inspection

ENT is a neat program to inspect the entropy and randomness of a sequence of bytes or bits. This table compares its output with values returned from rand(), mcrypt_create_iv() and this DPRNG. For explanations on the metrics see the ENT Website These numbers do only show that output of this DPRNG is sufficently random to be indistinguishable from random noise to HUMANS. Computers will be able to work out the initial salt given a RIDICULOUSLY SMALL SAMPLE!

RNG OS Entropy Arithmetic mean Chi-Square % Correlation coefficient Monte-Carlo PI error %
rand() Windows 10 7.998118 127.6669 99.99 -0.006520 0.55
DPRNG seeded by mcrypt_create_iv() Windows 10 7.992490 127.7548 29.17 0.005192 0.02
mcrypt_create_iv() Windows 10 7.993520 127.6631 86.44 0.010960 0.37
rand() Ubuntu 15.10 7.992890 127.6763 56.82 -0.004945 1.15
DPRNG seeded by mcrypt_create_iv() (a) Ubuntu 15.10 7.993482 127.8451 84.77 -0.000205 2.43
mcrypt_create_iv()(b) Ubuntu 15.10 7.993261 127.4429 73.70 0.000831 0.4

You can run these tests yourself with the ent executable and the entTestfile.php script.
(a) source = MCRYPT_DEV_RANDOM
(b) source = MCRYPT_DEV_URANDOM

Methods

Here is a full list of the methods supported by tmarsteel\dprng\DPRNG objects and their signatures + contracts:

float next()
Returns an uniformly distributed float value in the range [0, 1) (0 inclusive to 1 exclusive).

float nextFloat(float $from, float $to)
Returns an uniformly distributed float value in the range [$from, $to) ($from inclusive to $to exclusive).

int nextInt(int $from, int $to)
Returns an uniformly distributed integer in the range [$from, $to] ($from inclusive to $to inclusive).

array nextBytes(int $n)
Returns an array of length $n. Each entry is a uniformly distributed integer between 0 and 255.


All versions of dprng with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tmarsteel/dprng contains the following files

Loading the files please wait ....