1. Go to this page and download the library: Download emonkak/random library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
emonkak / random example snippets
use Emonkak\Random\Engine\MT19937Engine;
use Emonkak\Random\Distribution\NormalDistribution;
$seed = 100; // Initial seed
$engine = new MT19937Engine($seed); // 32bit Mersenne Twister engine
$distribution = new NormalDistribution(0, 1); // Standard normal distribution
// Generate a random number with the normal distribution.
$distribution->generate($engine);
// Also, the initial seed algorithm is full-compatible to the built-in `mt_srand()`
$engine = new MT19937Engine(/* $seed */);
// Get a next random number from the current generator state.
$number = $engine->next(); // as int
$number = $engine->nextDouble(); // as float
// Get the minimum and maximum number which generate a value by the engine.
$minimum = $engine->min();
$maximum = $engine->max();
// Iterate the generator engine.
foreach (new LimitIterator($engine, 0, 100) as $n) {
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.