PHP code example of tmarsteel / dprng
1. Go to this page and download the library: Download tmarsteel/dprng 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/ */
tmarsteel / dprng example snippets
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);
// generate random numbers
$random = $rng->next(); // random float from 0 inclusive to 1 exclusive (same range as Math.random())
$random = $rng->nextInt(14, 300); // random integer in the range 14 to 299
$bytes = $rng->nextBytes(30); // 30 random integers in the range 0 to 255